Search Postgresql Archives

Re: duplicate key violates unique constraint

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey, I've just find out what's happening.
The problem is the "serial" datatype creates a sequence in the background
(project_id_seq). If the sequence current numeber is 1, and I manually insert
a new entry whit ID=2, the sequence doesn't "know" it. So when I try the
INSERT statement, the next value in sequence is 2, and I get the error.
The thing is, I'm migrating my system from mysql to postgresql, and that's
why I was inserting directely the numbers (importing the .sql file), without
respecting the backgroud sequence.

Thanks a lot for those who answered me.
Regards,
Verônica




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux