0

I encounter this error message when running my specs after messing with gemsets and the pg gem version:

 # --- Caused by: ---
 # PG::UndefinedColumn:
 #   ERROR:  column "waiting" does not exist
 #   LINE 1: ...me AS source, age(now(), xact_start) AS duration, waiting, q...
 #                                                                ^
 #   /Users/xx/.rvm/gems/ruby-2.3.3@xx/gems/pghero-1.4.2/lib/pghero/methods/basic.rb:84:in `select_all'

I've tried using both versions of pg gem that I've used yesterday(0.18.4 and 0.19.0) by specifiying the exact version in the Gemfile, installing them (bundle install) and confirmed that the version is in deed used by checking Gemfile.lock. Both keep producing the error.

I am not really experienced, especially with Postgres. I don't know how gems and OS-packages play together etc. So I wanted to know if anyone knows what's going on and give me a tip?

Thanks

4

2 回答 2

1

问题是 Postgres 版本。在 9.6 pg_stat_activity

... 用 wait_event_type 和 wait_event 替换等待列。

作为解决方法,您可以尝试更改脚本,导致异常:

, age(now(), xact_start) AS duration, waiting,

至:

, age(now(), xact_start) AS duration, case when wait_event_type is null then false else true waiting,
于 2017-02-07T10:40:08.423 回答
1

我有以下问题和建议给你

  • 卸载 gemset 中的所有 pg gem 版本
  • 卸载pg英雄宝石
  • bundle install
  • 如果错误仍然存​​在,请尝试升级 pghero gem - 当前版本是 1.6.2(提到这个作为您的错误状态 pghero)

您是否切换到另一个 ruby​​ 版本(即使是次要的也是相关的)?如果是这样,请删除整个 gemset ( rvm gemset delete) 并运行一个新的bundle install. 这将针对更新的 ruby​​ 版本构建所有本机扩展。

希望这可以帮助。

于 2017-02-07T10:41:35.907 回答