[PG 1.0.0 x64-mingw32] Rails server not start after upgrade

Issue #270 resolved
Francesco Loreti
created an issue

Hi, I have upgrade pg gem from 0.21 to 1.0 (with rails 5.1.4 or 5.2 I have same error) and now my rails server not start.

The error with Rails 5.1.4:

=> Rails 5.1.4 application starting in development
=> Run `rails server -h` for more startup options
Exiting
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/connection_specification.rb:188:in `rescue in spec': Specified 'postgresql' for database adapter, but the gem i
s not loaded. Add `gem 'pg'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError)

The error with Rails 5.2.0.beta2:

=> Rails 5.2.0.beta2 application starting in development
=> Run `rails server -h` for more startup options
Exiting
C:/Ruby24-x64/lib/ruby/site_ruby/2.4.0/bundler/rubygems_integration.rb:404:in `block (2 levels) in replace_gem': Error loading the 'postgresql' Active Record adapter. Missing a gem it depends on? can't activ
ate pg (~> 0.18), already activated pg-1.0.0-x64-mingw32. Make sure all dependencies are added to Gemfile. (Gem::LoadError)

I have run the test and this is the result:

---
ruby 2.4.2p198 (2017-09-14 revision 59899) [x64-mingw32]
PG 1.0.0 (build fef434914848)
Server version: 100001
Client version: 100001
---
Expected this to return: ["select * from pg_stat_activity"]
["", "", "SELECT\n   (SELECT count(*) FROM pg_stat_activity WHERE datname = (SELECT datname FROM pg_database WHERE oid = 16991)) AS \"Total\",\n   (SELECT count(*) FROM pg_stat_activity WHERE state = 'active
' AND datname = (SELECT datname FROM pg_database WHERE oid = 16991))  AS \"Active\",\n   (SELECT count(*) FROM pg_stat_activity WHERE state = 'idle' AND datname = (SELECT datname FROM pg_database WHERE oid =
 16991))  AS \"Idle\"", "SELECT oid, format_type(oid,null) as typname FROM pg_type WHERE oid IN (19, 1184, 25, 1184, 25, 869, 1184, 23, 25, 26, 23, 25, 28, 28, 25, 25, 19, 1184, 25, 26) ORDER BY oid;\n", "se
lect * from pg_stat_activity", "SELECT * from pg_stat_activity", "", "", ""]

If I return to "0.21.0 x64-mingw32" gem version, I don't have any problem.

Comments (11)

  1. Lars Kanis

    rails-5.1.5 fixes compatibility with pg-1.0.

    rails-5.0.7 is not yet released, but should fix it equally.

    Older rails projects need to stick with gem "pg", "< 1.0" .

  2. Log in to comment