From 0f6c33c371da0628a1cd0382d12e6cd4df0020a8 Mon Sep 17 00:00:00 2001 From: Rylan Bowers Date: Thu, 10 Dec 2020 08:50:40 -0700 Subject: [PATCH 1/2] Trying to update the PG gem after Heroku updated Postgres version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This blew up the app with error around ‘panic’ as a status --- Gemfile | 2 +- Gemfile.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 7efb3440..0d7af047 100755 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ source 'https://rubygems.org' ruby File.read('.ruby-version').strip # the base rails libraries -gem 'pg' +gem 'pg', '~> 0.18.4' gem 'rails', '~> 3.2.16' gem 'rails_12factor' gem 'thin' diff --git a/Gemfile.lock b/Gemfile.lock index e456bed8..c692a589 100755 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -432,7 +432,7 @@ DEPENDENCIES json newrelic_rpm paperclip! - pg + pg (~> 0.18.4) poltergeist (~> 1.12) prawn (~> 2.1.0) prawn-table (~> 0.2.2) From 7c4e52fe70afaa16e2c471be679f286bd588d88f Mon Sep 17 00:00:00 2001 From: Rylan Bowers Date: Thu, 10 Dec 2020 08:58:27 -0700 Subject: [PATCH 2/2] Adding a monkey patch :( to try to fix this PG issue. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Found via https://stackoverflow.com/questions/58763542/pginvalidparametervalue-error-invalid-value-for-parameter-client-min-messag Heroku just upgraded Postgres to something … which I can’t tell which version or why this started failing. --- config/initializers/postgresql_adapter_monkeypatch.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 config/initializers/postgresql_adapter_monkeypatch.rb diff --git a/config/initializers/postgresql_adapter_monkeypatch.rb b/config/initializers/postgresql_adapter_monkeypatch.rb new file mode 100644 index 00000000..f864a60a --- /dev/null +++ b/config/initializers/postgresql_adapter_monkeypatch.rb @@ -0,0 +1,10 @@ +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