diff options
Diffstat (limited to 'activerecord/lib/active_record/fixtures.rb')
-rwxr-xr-x | activerecord/lib/active_record/fixtures.rb | 2 |
1 files changed, 1 insertions, 1 deletions
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 |