rails: PGconn, PGresult, and PGError constants are deprecated
(I couldn’t find another issue about this, sorry if it has already been addressed)
Using both Rails 5.1.0
and 5.1.2.rc1
, I get the following message on boot:
The PGconn, PGresult, and PGError constants are deprecated, and will be
removed as of version 1.0.
You should use PG::Connection, PG::Result, and PG::Error instead, respectively.
Called from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:258:in `load_dependency'
My pg
version is 0.21.0
.
Downgrading to 0.20
makes the warning go away.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 28
- Comments: 15 (2 by maintainers)
Commits related to this issue
- Lock PG gem to 0.20 See https://github.com/rails/rails/issues/29521 — committed to tarebyte/gdi-website by tarebyte 7 years ago
- Rails 4.2.x wymaga pg 0.20 https://github.com/rails/rails/issues/29521#issuecomment-312159094 — committed to ziher/ziher by magdzikk 7 years ago
- modified: Gemfile https://github.com/rails/rails/issues/29521 Locked to pg 0.20 modified: Gemfile.lock rake db:migrate modified: db/migrate/20171122184040_create_things.rb new file: ... — committed to meredoschi/gradcert by meredoschi 7 years ago
- lock version of pg gem (temporarily) https://github.com/rails/rails/issues/29521 — committed to khaleksa/birds by khaleksa 6 years ago
- Downgrade postgres to remove PG::Connection error Dumb solution but works. https://github.com/rails/rails/issues/29521 Eventually may upgrade in general. — committed to azirbel/npoint by azirbel 6 years ago
- Lock PG gem to 0.20 See rails/rails#29521 — committed to zealot128/filter-app by deleted user 6 years ago
- pins pg gem to 0.20 (see https://github.com/rails/rails/issues/29521) — committed to marschwar/livescore by deleted user 6 years ago
- Lock pg gem to 0.20.0 to silence deprecation warnings until update to 5 - Deprecation warnings were related to "PGconn, PGresult, and PGError constants are deprecated" - Reference: https://github.com... — committed to raysapida/treebook by raysapida 6 years ago
- Lock pg gem version to 0.20.0 Due to a deprecation warning. The deprecation was fixed in laters versions of Rails. Reference: https://github.com/rails/rails/issues/29521 — committed to welaika/rails_invaders by AleOnRails 6 years ago
- revert PG to avoid error message https://github.com/rails/rails/issues/29521 — committed to slead/Ignite by slead 6 years ago
Confirmed. Locked to
pg 0.20
and now clean as a whistle.My problem was the
seuqel_pg
wasn’t updated to use the new constants. I’m awaiting that gem’s next update. You can also downgrade topg 0.20
but that’s not worth the tradeoff to get rid of an otherwise harmless warning message.According to @y-yagi’s comment, only
rails 5.0.x
andrails 5.1.x
have been updated to be aware of the new constants. If you’re onrails 4.2.x
you need to either lock topg 0.20
or upgrade to Rails 5.I am facing this issue with
rails 5.0.1
,pg 0.21.0
.Yes exactly I have found the solution after many searching, thanks to the Stack Overflow I have edited Gemfile like
gem 'pg', '~> 0.11'
Then updated bundle
https://stackoverflow.com/a/49150265/4172515
The above correspondence is included in Rails 5.0.3 or later. Please update Rails.
You’re right, this was due to the
sequel_pg
gem, not Rails. Confusing because the only line in the warning stack trace was fromactivesupport-5.1.1
@kniazeu we need to lock the PG gem to 0.20 to remove the deprecation messages.