如何解决此Postgresql无效的Paramater错误?

时间:2020-02-29 17:14:49

标签: ruby-on-rails database postgresql

我正在从命令行运行rake db:create命令,它给了我以下错误:

2020-02-29 15:22:21.033 GMT [39162] ERROR:  invalid value for parameter "client_min_messages": "panic"
2020-02-29 15:22:21.033 GMT [39162] HINT:  Available values: debug5, debug4, debug3, debug2, debug1, log, notice, warning, error.
2020-02-29 15:22:21.033 GMT [39162] STATEMENT:  SET client_min_messages TO 'panic'
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'

Postgresql版本为9.4.26

database.yml文件提取为

development:
  <<: *default
  host: localhost
  username: postgres
  database: my_database
  password: my_database

在向正确的方向指点我之前,我真的很感激任何处理过此问题的人。据我所知,我需要修改pg_config以禁止使用'Panic'变量,但找不到有关如何执行此操作的指导。

1 个答案:

答案 0 :(得分:0)

我想出了解决此问题的方法:

postgresql_adapter.rb文件中的此方法:

for (Recipe recipe : recipesFounded) {
    if (recipe.getTitle().toLowerCase()
            .contains(word)) {
       trueOnes.add(recipe);
    }
}

也需要修改:

def set_standard_conforming_strings
    old, self.client_min_messages = client_min_messages, 'panic'
    execute('SET standard_conforming_strings = on', 'SCHEMA') rescue nil
ensure
    self.client_min_messages = old
end

如何查找:

def set_standard_conforming_strings
    old, self.client_min_messages = client_min_messages, 'error'
    execute('SET standard_conforming_strings = on', 'SCHEMA') rescue nil
ensure
    self.client_min_messages = old
end

CD定位-对我来说是:

gem pg info

然后:

/Users/williammurphy/.rvm/gems/ruby-2.2.4

将设置为“紧急”的任何内容更改为“错误”,这应该会帮助您。