Search Postgresql Archives

Re: What's the best way to deal with the pk_seq sequence value after a restore (bulk loading)?

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

 



"Wang, Mary Y" <mary.y.wang@xxxxxxxxxx> writes:
> After a restore, I got a lot errors like this one : "duplicate key value violates unique constraint "bug_pkey"".  After looking at the dump file, it has
> ...
> Because the current value is 6818, during the restore process, it
> complained about "duplicate key value violates unique constraint
> "bug_pkey, because the value of  bug_pk_seq for a insert has been
> already been used.

No, the setting of the sequence doesn't have anything to do with that,
because the dumped data doesn't rely on using the column's default
expression.  It's pretty strange to get such an error during restore,
though.  It implies that the data was inconsistent in the original
database.

Or are you saying that after you've completed the restore, subsequent
attempts to insert get that type of error?  If that's the case, what
you need to do is set the sequence value *higher* than the max value
currently present in the table, not reset it to 1.

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[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