Flip
Flip

Reputation: 6781

Rails / Postgres: Error after changing pg gem version

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

Upvotes: 0

Views: 1120

Answers (2)

basiszwo
basiszwo

Reputation: 620

I have the following questions and advices for you

  • uninstall all pg gem version in your gemset
  • uninstall pg hero gem
  • run bundle install
  • in case the error still resides then try upgrading the pghero gem - current version is 1.6.2 (mentioning this as your error states pghero)

Did you switch to another ruby version (even minor is relevant)? If so drop the whole gemset (rvm gemset delete) and run a fresh bundle install. This will build all native extensions against the updated ruby version.

Hope this helps.

Upvotes: 1

Vao Tsun
Vao Tsun

Reputation: 51649

The problem is Postgres version. in 9.6 pg_stat_activity

... replace the waiting column with wait_event_type and wait_event.

As workaround you can try change in script, causing exception:

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

to:

, age(now(), xact_start) AS duration, case when wait_event_type is null then false else true waiting,

Upvotes: 1

Related Questions