In PostgreSQL 12 they disallowed the PANIC
value for client_min_messages
, that Rails was setting since 2.3.14. That was fixed in Rails 4.2.5.
Last active
November 19, 2021 00:35
-
-
Save x-yuri/d76b487c49698cd80edd511ed58bfb81 to your computer and use it in GitHub Desktop.
#rails #pg #client-min-messages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -eux | |
extract_trap_cmd() { | |
if [ "${3-}" != - ]; then | |
printf '%s\n' "${3-}" | |
fi | |
} | |
get_exit_trap_cmd() { | |
eval "extract_trap_cmd $(trap -p EXIT)" | |
} | |
add_exit_trap_handler() { | |
trap "$1; $(get_exit_trap_cmd)" EXIT | |
} | |
rails_version=$1 | |
pg_version=$2 | |
docker network create n1 && add_exit_trap_handler "docker network rm n1" || true | |
rb=`docker run --rm -d --network n1 ruby:2.6-alpine sleep infinity` | |
add_exit_trap_handler "docker stop $rb" | |
db1=`docker run --rm -d --network n1 -e POSTGRES_HOST_AUTH_METHOD=trust --name db1 postgres:$pg_version` | |
add_exit_trap_handler "docker stop $db1" | |
docker exec "$rb" sh -euxc " | |
apk add build-base postgresql-dev nodejs yarn tzdata git | |
gem install rails -v \"$rails_version\" | |
rails new -d postgresql app | |
cd app | |
sed -Ei \"s/^gem 'pg'/gem 'pg', '~> 0.15'/\" Gemfile | |
bundle | |
sed -Ei \"s/(adapter: .*)/\\\\1\n host: db1\n username: postgres/\" config/database.yml | |
DISABLE_SPRING=1 bin/rake db:create | |
" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./b.sh 4.2.4 11 | |
... | |
+ DISABLE_SPRING=1 bin/rake db:create | |
/usr/local/bundle/gems/activesupport-4.2.4/lib/active_support/core_ext/object/duplicable.rb:85: warning: BigDecimal.new is deprecated; use BigDecimal() method instead. | |
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 /usr/local/bundle/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240:in `load_dependency' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./b.sh 4.2.4 12.0 | |
... | |
+ DISABLE_SPRING=1 bin/rake db:create | |
/usr/local/bundle/gems/activesupport-4.2.4/lib/active_support/core_ext/object/duplicable.rb:85: warning: BigDecimal.new is deprecated; use BigDecimal() method instead. | |
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 /usr/local/bundle/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240:in `load_dependency' | |
PG::InvalidParameterValue: ERROR: invalid value for parameter "client_min_messages": "panic" | |
HINT: Available values: debug5, debug4, debug3, debug2, debug1, log, notice, warning, error. | |
: SET client_min_messages TO 'panic' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `async_exec' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `block in execute' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract_adapter.rb:473:in `block in log' | |
/usr/local/bundle/gems/activesupport-4.2.4/lib/active_support/notifications/instrumenter.rb:20:in `instrument' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract_adapter.rb:467:in `log' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:154:in `execute' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/postgresql/schema_statements.rb:275:in `client_min_messages=' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/postgresql_adapter.rb:313:in `set_standard_conforming_strings' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/postgresql_adapter.rb:681:in `configure_connection' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/postgresql_adapter.rb:662:in `connect' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in `new_connection' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `checkout_new_connection' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout' | |
/usr/local/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection' | |
/usr/local/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:571:in `retrieve_connection' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_handling.rb:113:in `retrieve_connection' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_handling.rb:87:in `connection' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/tasks/postgresql_database_tasks.rb:8:in `connection' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/tasks/postgresql_database_tasks.rb:17:in `create' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/tasks/database_tasks.rb:93:in `create' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/tasks/database_tasks.rb:107:in `block in create_current' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/tasks/database_tasks.rb:275:in `block in each_current_configuration' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/tasks/database_tasks.rb:274:in `each' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/tasks/database_tasks.rb:274:in `each_current_configuration' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/tasks/database_tasks.rb:106:in `create_current' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/railties/databases.rake:17:in `block (2 levels) in <top (required)>' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:281:in `block in execute' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:281:in `each' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:281:in `execute' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:219:in `block in invoke_with_call_chain' | |
/usr/local/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:199:in `invoke_with_call_chain' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:188:in `invoke' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:160:in `invoke_task' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:116:in `block (2 levels) in top_level' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:116:in `each' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:116:in `block in top_level' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:125:in `run_with_threads' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:110:in `top_level' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:83:in `block in run' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:186:in `standard_exception_handling' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:80:in `run' | |
bin/rake:9:in `<main>' | |
Couldn't create database for {"adapter"=>"postgresql", "host"=>"db1", "username"=>"postgres", "encoding"=>"unicode", "pool"=>5, "database"=>"app_development"} | |
PG::InvalidParameterValue: ERROR: invalid value for parameter "client_min_messages": "panic" | |
HINT: Available values: debug5, debug4, debug3, debug2, debug1, log, notice, warning, error. | |
: SET client_min_messages TO 'panic' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `async_exec' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `block in execute' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract_adapter.rb:473:in `block in log' | |
/usr/local/bundle/gems/activesupport-4.2.4/lib/active_support/notifications/instrumenter.rb:20:in `instrument' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract_adapter.rb:467:in `log' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:154:in `execute' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/postgresql/schema_statements.rb:275:in `client_min_messages=' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/postgresql_adapter.rb:313:in `set_standard_conforming_strings' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/postgresql_adapter.rb:681:in `configure_connection' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/postgresql_adapter.rb:662:in `connect' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in `new_connection' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `checkout_new_connection' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout' | |
/usr/local/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection' | |
/usr/local/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:571:in `retrieve_connection' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_handling.rb:113:in `retrieve_connection' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/connection_handling.rb:87:in `connection' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/tasks/postgresql_database_tasks.rb:8:in `connection' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/tasks/postgresql_database_tasks.rb:17:in `create' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/tasks/database_tasks.rb:93:in `create' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/tasks/database_tasks.rb:107:in `block in create_current' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/tasks/database_tasks.rb:275:in `block in each_current_configuration' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/tasks/database_tasks.rb:274:in `each' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/tasks/database_tasks.rb:274:in `each_current_configuration' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/tasks/database_tasks.rb:106:in `create_current' | |
/usr/local/bundle/gems/activerecord-4.2.4/lib/active_record/railties/databases.rake:17:in `block (2 levels) in <top (required)>' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:281:in `block in execute' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:281:in `each' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:281:in `execute' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:219:in `block in invoke_with_call_chain' | |
/usr/local/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:199:in `invoke_with_call_chain' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:188:in `invoke' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:160:in `invoke_task' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:116:in `block (2 levels) in top_level' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:116:in `each' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:116:in `block in top_level' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:125:in `run_with_threads' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:110:in `top_level' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:83:in `block in run' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:186:in `standard_exception_handling' | |
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:80:in `run' | |
bin/rake:9:in `<main>' | |
Couldn't create database for {"adapter"=>"postgresql", "host"=>"db1", "username"=>"postgres", "encoding"=>"unicode", "pool"=>5, "database"=>"app_test"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./b.sh 4.2.5 12.0 | |
... | |
+ DISABLE_SPRING=1 bin/rake db:create | |
/usr/local/bundle/gems/activesupport-4.2.5/lib/active_support/core_ext/object/duplicable.rb:85: warning: BigDecimal.new is deprecated; use BigDecimal() method instead. | |
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 /usr/local/bundle/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:240:in `load_dependency' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment