From 3fa38c4dba8382753c528003f97f7d1e164f01b0 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 27 Sep 2005 20:24:52 +0000 Subject: Oops, swapped order of params to COALESCE! Upcoming patch has test cases. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2370 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/fixtures.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index eb97c0f469..5a7ccc8384 100755 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -254,7 +254,7 @@ class Fixtures < Hash pk = table_class.columns_hash[table_class.primary_key] if pk and pk.type == :integer connection.execute( - "SELECT setval('#{table}_#{pk.name}_seq', (SELECT COALESCE(0, MAX(#{pk.name}))+1 FROM #{table}), false)", + "SELECT setval('#{table}_#{pk.name}_seq', (SELECT COALESCE(MAX(#{pk.name}), 0)+1 FROM #{table}), false)", 'Setting Sequence' ) end -- cgit v1.2.3