Silence warnings for ruby-pg
What does this MR do and why?
This commit silences the following deprecation warning:
PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from ...
See !118484 (comment 1366522061)
How to set up and validate locally
- Switch to
master
- Checkout !118484 (merged) to upgrade
pg
to1.5.1
- Run Rails console and see deprecation warnings (with
pg 1.5
+)
$ bin/rails console
PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from /home/peter/.dotfiles/asdf/installs/ruby/3.0.5/lib/ruby/gems/3.0.0/gems/activerecord-6.1.7.2/lib/active_record/connection_adapters/postgresql_adapter.rb:883:in `new'
PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from /home/peter/.dotfiles/asdf/installs/ruby/3.0.5/lib/ruby/gems/3.0.0/gems/activerecord-6.1.7.2/lib/active_record/connection_adapters/postgresql_adapter.rb:883:in `new'
PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from /home/peter/.dotfiles/asdf/installs/ruby/3.0.5/lib/ruby/gems/3.0.0/gems/activerecord-6.1.7.2/lib/active_record/connection_adapters/postgresql_adapter.rb:883:in `new'
--------------------------------------------------------------------------------
Ruby: ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c5) [x86_64-linux]
GitLab: 16.0.0-pre (80b851d6032) EE
GitLab Shell: 14.18.0
PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from /home/peter/.dotfiles/asdf/installs/ruby/3.0.5/lib/ruby/gems/3.0.0/gems/activerecord-6.1.7.2/lib/active_record/connection_adapters/postgresql_adapter.rb:883:in `new'
PostgreSQL: 12.13
-------------------------------------------------------------[ booted in 5.88s ]
Loading development environment (Rails 6.1.7.2)
[1] pry(main)> User.first
PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from /home/peter/.dotfiles/asdf/installs/ruby/3.0.5/lib/ruby/gems/3.0.0/gems/activerecord-6.1.7.2/lib/active_record/connection_adapters/postgresql_adapter.rb:883:in `new'
User Load (2.3ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1 /*application:console,db_config_name:main,console_hostname:happy,console_username:peter,line:(pry):1:in `__pry__'*/
=> #<User id:1 @root>
- Cherry pick c1658960 via
git cherry-pick c165896065d9
on the previously checked out branch - Rerun Rails console again and watch the warnings disappear
✅ :
$ bin/rails console
--------------------------------------------------------------------------------
Ruby: ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c5) [x86_64-linux]
GitLab: 16.0.0-pre (df861999197) EE
GitLab Shell: 14.18.0
PostgreSQL: 12.13
-------------------------------------------------------------[ booted in 7.90s ]
Loading development environment (Rails 6.1.7.2)
[1] pry(main)> User.first
User Load (2.5ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1 /*application:console,db_config_name:main,console_hostname:happy,console_username:peter,line:(pry):1:in `__pry__'*/
=> #<User id:1 @root>
- And with
RAILS_ENV=production
(adjustconfig/database.yml
accordingly):
$ RAILS_ENV=production bin/rails console
--------------------------------------------------------------------------------
Ruby: ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c5) [x86_64-linux]
GitLab: 16.0.0-pre (df861999197) EE
GitLab Shell: 14.18.0
PostgreSQL: 12.13
------------------------------------------------------------[ booted in 25.71s ]
Loading production environment (Rails 6.1.7.2)
>> User.first
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Peter Leitzen