提交 3fa38c4d 编写于 作者: J Jeremy Kemper

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
上级 fe0ffe40
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册