From 78f6268977d80f3e6dcb916dd185ef046caf8586 Mon Sep 17 00:00:00 2001 From: Dylan Markow Date: Fri, 7 Jun 2013 17:36:37 -0500 Subject: Handle single quotes in PostgreSQL default column values PostgreSQL escapes single quotes by using an additional single quote. When Rails queries the column information, PostgreSQL returns the default values with the escaped single quotes. #extract_value_from_default now converts these to one single quote each. Fixes #10881. --- .../lib/active_record/connection_adapters/postgresql_adapter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index d5a603cadc..98126249df 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -84,7 +84,7 @@ module ActiveRecord $1 # Character types when /\A\(?'(.*)'::.*\b(?:character varying|bpchar|text)\z/m - $1 + $1.gsub(/''/, "'") # Binary data types when /\A'(.*)'::bytea\z/m $1 -- cgit v1.2.3