gpt4 book ai didi

ruby-on-rails - PG::InvalidParameterValue: 错误:参数 "client_min_messages"的无效值: "panic"

转载 作者:行者123 更新时间:2023-11-29 13:07:56 27 4
gpt4 key购买 nike

rake db:create 显示错误 PG::InvalidParameterValue: ERROR: invalid value for parameter "client_min_messages": "panic"提示:可用值:debug5、debug4、debug3、debug2、debug1、log、notice、warning、error。

在 bundle install 尝试运行 rake db:create commond 之后。在配置文件夹中创建了 database.yml 文件,请在下面找到:

development:
adapter: postgresql
encoding: utf8
database: thor_development1
username: postgres
password:
host: localhost

test:
adapter: postgresql
encoding: utf8
database: thor_test1
username: postgres
password:
host: localhost
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'
/Users/galaxy/.rvm/gems/ruby-2.1.2@folderName/gems/activerecord-4.1.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in `async_exec'
/Users/galaxy/.rvm/gems/ruby-2.1.2@folderName/gems/activerecord-4.1.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in `block in execute'
/Users/galaxy/.rvm/gems/ruby-2.1.2@folderName/gems/activerecord-4.1.6/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/Users/galaxy/.rvm/gems/ruby-2.1.2@folderName/gems/activesupport-4.1.6/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/galaxy/.rvm/gems/ruby-2.1.2@folderName/gems/activerecord-4.1.6/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/Users/galaxy/.rvm/gems/ruby-2.1.2@folderName/gems/activerecord-4.1.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:127:in `execute'
/Users/galaxy/.rvm/gems/ruby-2.1.2@folderName/gems/activerecord-4.1.6/lib/active_record/connection_adapters/postgresql/schema_statements.rb:274:in `client_min_messages='
/Users/galaxy/.rvm/gems/ruby-2.1.2@folderName/gems/activerecord-4.1.6/lib/active_record/connection_adapters/postgresql_adapter.rb:634:in `set_standard_conforming_strings'
/Users/galaxy/.rvm/gems/ruby-2.1.2@folderName/gems/activerecord-4.1.6/lib/active_record/connection_adapters/postgresql_adapter.rb:914:in `configure_connection'
/Users/galaxy/.rvm/gems/ruby-2.1.2@folderName/gems/activerecord-4.1.6/lib/active_record/connection_adapters/postgresql_adapter.rb:895:in `connect'
/Users/galaxy/.rvm/gems/ruby-2.1.2@folderName/gems/activerecord-4.1.6/lib/active_record/connection_adapters/postgresql_adapter.rb:568:in `initialize'

尝试在 macOS Catalina 中安装

最佳答案

为了使其与 PostgreSQL 版本 12 一起使用,我猴子修补了 PostgreSQLAdapter 类以将“ panic ”替换为“警告”消息。请注意,如果您可以将 activerecord gem 升级到 4.2.6 或更高版本,则不需要安装此猴子补丁。我必须这样做,因为我的项目依赖于 gem activerecord-3.2.22.5

require 'active_record/connection_adapters/postgresql_adapter'

class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
def set_standard_conforming_strings
old, self.client_min_messages = client_min_messages, 'warning'
execute('SET standard_conforming_strings = on', 'SCHEMA') rescue nil
ensure
self.client_min_messages = old
end
end

关于ruby-on-rails - PG::InvalidParameterValue: 错误:参数 "client_min_messages"的无效值: "panic",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58763542/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com