The following bug has been logged online:
Bug reference: 3891
Logged by: Adriaan van Os
Email address: postgres(at)microbizz(dot)nl
PostgreSQL version: 8.2.4
Operating system: Mac OS X 10.5
Description: Multiple UPDATE doesn't handle UNIQUE constraint
Suppose we have a table A with a UNIQUE column Name of type VARCHAR, a
PRIMARY KEY record_id of type INT4 and the following records
Furthermore, we have a temporary table temp_A with a UNIQUE column Name of
type VARCHAR, a PRIMARY KEY record_id of type INT4 and the following
Now, we update table A with values from temporary table temp_A doing
UPDATE "A" SET "Name" = "temp_A"."Name" FROM "temp_A" WHERE "A".record_id =
This will cause a UNIQUE violation in de middle of the UPDATE statement,
although after completion of the statement there is no such violation.
Although deferred constraints are not yet implemented for Postgres, the docs
IMMEDIATE constraints are checked at the end of each statement.
Apparently, this is not correct, as in the above example constraints are
checked in the middle of a statement, rather than at the end.
I feel the docs are right here and the software wrong.
Adriaan van Os
pgsql-bugs by date
|Next:||From: Roman||Date: 2008-01-21 08:20:22|
|Subject: BUG #3892: Invalid week determination|
|Previous:||From: Ottó Havasvölgyi||Date: 2008-01-21 08:13:41|
|Subject: Re: Casting on the limit|