PG::InvalidParameterValue:错误:参数“client\u min\u messages”的值无效:“panic”

rake db:create显示错误PG::InvalidParameterValue:错误:参数“client_min_messages”的值无效:“panic”
提示:可用值:debug5、debug4、debug3、debug2、debug1、日志、通知、警告、错误

捆绑安装后,尝试运行rake db:create commond。
已在配置文件夹中创建database.yml文件,请查找以下内容:

开发:
适配器:postgresql
编码:utf8
数据库:thor_development1
用户名:postgres
密码:
主机:本地主机
测试:
适配器:postgresql
编码:utf8
数据库:thor_test1
用户名:postgres
密码:
主机:本地主机
PG::InvalidParameterValue:错误:参数“client\u min\u messages”的值无效:“panic”
提示:可用值:debug5、debug4、debug3、debug2、debug1、日志、通知、警告、错误。
:将客户端消息设置为“紧急”
/Users/galaxy/.rvm/gems/ruby-2.1。[email protected]/gems/activerecord-4.1.6/lib/active\u record/connection\u adapters/postgresql/database\u语句。rb:128:in`async\u exec'
/Users/galaxy/.rvm/gems/ruby-2.1。[email protected]/gems/activerecord-4.1.6/lib/active\u record/connection\u adapters/postgresql/database\u语句。rb:128:in`block in execute'
/Users/galaxy/.rvm/gems/ruby-2.1。[email protected]/gems/activerecord-4.1.6/lib/active\u record/connection\u adapters/abstract\u adapter.rb:373:in`block in log'
/Users/galaxy/.rvm/gems/ruby-2.1。[email protected]/gems/activesupport-4.1.6/lib/active\u-support/notifications/instrumenter.rb:20:in'instrument'
/Users/galaxy/.rvm/gems/ruby-2.1。[email protected]/gems/activerecord-4.1.6/lib/active\u record/connection\u adapters/abstract\u adapter.rb:367:in`log'
/Users/galaxy/.rvm/gems/ruby-2.1。[email protected]/gems/activerecord-4.1.6/lib/active\u record/connection\u adapters/postgresql/database\u语句。rb:127:in'execute'
/Users/galaxy/.rvm/gems/ruby-2.1。[email protected]/gems/activerecord-4.1.6/lib/active\u record/connection\u adapters/postgresql/schema\u语句。rb:274:in`client\u min\u messages='10
/Users/galaxy/.rvm/gems/ruby-2.1。[email protected]/gems/activerecord-4.1.6/lib/active\u record/connection\u adapters/postgresql\u adapter.rb:634:in`set\u standard\u compliance\u strings'
/Users/galaxy/.rvm/gems/ruby-2.1。[email protected]/gems/activerecord-4.1.6/lib/active\u record/connection\u adapters/postgresql\u adapter.rb:914:在“配置连接”中
/Users/galaxy/.rvm/gems/ruby-2.1。[email protected]/gems/activerecord-4.1.6/lib/active\u record/connection\u adapters/postgresql\u adapter.rb:895:in'connect'
/Users/galaxy/.rvm/gems/ruby-2.1。[email protected]/gems/activerecord-4.1.6/lib/active\u record/connection\u adapters/postgresql\u adapter.rb:568:in'initialize'

正在尝试在macOS Catalina中安装

为了使其与PostgreSQL版本12兼容,我对PostgreSQLAdapter类进行了修补,以“警告”消息替换“恐慌”。
注意,如果您可以将activerecord gem升级到4.2.6或更高版本,则不需要使用此monkey补丁。我不得不这样做,因为我的项目依赖于gemactiverecord-3.2.22.5

需要“活动\u记录/连接\u适配器/postgresql\u适配器”
类ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
def set_标准_一致_字符串
旧的self.client\u min\u消息=client\u min\u消息,“警告”
执行('SET standard\u conficification\u strings=on','SCHEMA')rescue nil
确保
self.client_min_messages=旧
终止
终止

发表评论