From 684caf55038234374a17c1e010e8b18d2dc0c90f Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Mon, 18 May 2015 10:31:02 -0700 Subject: Fix `serial?` with quoted sequence name --- .../lib/active_record/connection_adapters/postgresql/column.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/column.rb b/activerecord/lib/active_record/connection_adapters/postgresql/column.rb index be13ead120..bfa03fa136 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/column.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/column.rb @@ -8,7 +8,8 @@ module ActiveRecord def serial? return unless default_function - %r{\Anextval\('(?.+)_#{name}_seq'::regclass\)\z} === default_function + table_name = @table_name || '(?.+)' + %r{\Anextval\('"?#{table_name}_#{name}_seq"?'::regclass\)\z} === default_function end end end -- cgit v1.2.3