Re: [BUGS] BUG #14596: False primary/unique key constraint violations
| От | Tom Lane |
|---|---|
| Тема | Re: [BUGS] BUG #14596: False primary/unique key constraint violations |
| Дата | |
| Msg-id | 31317.1490193907@sss.pgh.pa.us обсуждение |
| Ответ на | [BUGS] BUG #14596: False primary/unique key constraint violations (rasmus@mindplay.dk) |
| Ответы |
Re: [BUGS] BUG #14596: False primary/unique key constraint violations
|
| Список | pgsql-bugs |
rasmus@mindplay.dk writes:
> It looks like constraints are being checked row-by-row while the udpate is
> happening?
This is documented somewhere ... ah, here, in the COMPATIBILITY section of
the CREATE TABLE reference page:
Non-deferred Uniqueness Constraints
When a UNIQUE or PRIMARY KEY constraint is not deferrable, PostgreSQL
checks for uniqueness immediately whenever a row is inserted or
modified. The SQL standard says that uniqueness should be enforced only
at the end of the statement; this makes a difference when, for example,
a single command updates multiple key values. To obtain
standard-compliant behavior, declare the constraint as DEFERRABLE but
not deferred (i.e., INITIALLY IMMEDIATE). Be aware that this can be
significantly slower than immediate uniqueness checking.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
В списке pgsql-bugs по дате отправления: