Search code examples
ruby-on-railspostgresqlbundlergemset

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


Solution

  • 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.