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

前端 未结 6 813
無奈伤痛
無奈伤痛 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:45

    I needed to make the following modifications to the monkey patch from @ruslan to work with Rails 4.2.4:

    require 'active_record/connection_adapters/postgresql_adapter'
    
    module ActiveRecord
      module ConnectionAdapters
        class 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
      end
    end
    

提交回复
热议问题