PG::InvalidParameterValue: ERROR: invalid value for parameter “client_min_messages”: “panic”

前端 未结 6 856
無奈伤痛
無奈伤痛 2020-12-18 19:13

rake db:create showing error PG::InvalidParameterValue: ERROR: invalid value for parameter \"client_min_messages\": \"panic\" HINT: Available values: debug5, debug4, debug

6条回答
  •  借酒劲吻你
    2020-12-18 19:27

    To make it work with PostgreSQL version 12, I monkey patched PostgreSQLAdapter class to replace 'panic' with 'warning' message. Note, if you can upgrade activerecord gem to 4.2.6 or higher versions you don't need to have this monkey patch. I had to do this because my project depends on 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
    

提交回复
热议问题