From d05bfa82ae1bb6dfb6dd4c4a7e089eff456cf4af Mon Sep 17 00:00:00 2001 From: Harry Marr Date: Thu, 29 Oct 2015 12:03:43 +0000 Subject: Check standard_conforming_strings is not readonly In Postgres 8.1 the standard_conforming_strings setting was read-only, meaning you got an error if you tried to update it. By filtering on `context = 'user'` we only try to update the setting if it's user-writable[1]. [1]: http://www.postgresql.org/docs/9.4/static/view-pg-settings.html --- .../lib/active_record/connection_adapters/postgresql_adapter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 2c9b1a0b3d..1b8f8cab94 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -286,7 +286,7 @@ module ActiveRecord execute(<<-SQL, 'SCHEMA') UPDATE pg_settings SET setting = 'on' - WHERE name = 'standard_conforming_strings' + WHERE name = 'standard_conforming_strings' AND context = 'user' SQL end -- cgit v1.2.3