Skip to content

Commit

Permalink
Oops, swapped order of params to COALESCE! Upcoming patch has test ca…
Browse files Browse the repository at this point in the history
…ses.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2370 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
jeremy committed Sep 27, 2005
1 parent fe0ffe4 commit 3fa38c4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/fixtures.rb
Expand Up @@ -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
Expand Down

0 comments on commit 3fa38c4

Please sign in to comment.