Permalink
Browse files

Oops, swapped order of params to COALESCE! Upcoming patch has test ca…

…ses.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2370 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent fe0ffe4 commit 3fa38c4dba8382753c528003f97f7d1e164f01b0 @jeremy jeremy committed Sep 27, 2005
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/fixtures.rb
View
2 activerecord/lib/active_record/fixtures.rb
@@ -254,7 +254,7 @@ def self.reset_sequences(connection, table_names)
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

0 comments on commit 3fa38c4

Please sign in to comment.