Robby Russell wrote:
> On Apr 29, 2006, at 5:56 PM, Guido Sohne wrote:
>
>> Throws an exception due to the following SQL error: duplicate key
>> violates unique constraint.
>
> Your primary key index isn't in sync or something.
> SELECT MAX(id) FROM entities;
>
> SELECT nextval('entities_id_seq');
>
> This should be higher than the last result.
>
> If it's not higher... run this to try and fix it. (run a quick
> pg_dump first...)
>
> SELECT setval('entities_id_seq', (SELECT MAX(id) FROM entities)+1);
Let me up this thread as it just saved my a$$!
Is this considered a bug or a feature? Because people easily get trapped
into it!
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.