Mladen Gogala <mladen(dot)gogala(at)vmsinfo(dot)com> writes:
> In Oracle, deferrable primary keys are enforced by non-unique indexes.
> That seems logical,
... maybe to an Oracle guy ...
> When the constraint is deferred in the transaction block, however, it
> tolerates duplicate values until the end of transaction:
Sure. That's exactly per spec: the check is deferred to end of
transaction. If the duplicated index entries are both/all still live
at that time, you get an error.
We do still execute the insertion-time uniqueness check, but instead of
throwing an error on failure, we just queue a trigger event to recheck
that key before commit. If the insertion-time check passes then there's
no need for a recheck later. This is a win because the insertion-time
check is cheap, being integrated into the insertion process itself.
regards, tom lane
In response to
Responses
pgsql-novice by date
| Next: | From: Mladen Gogala | Date: 2010-12-01 17:28:17 |
| Subject: Re: Clarification, please |
| Previous: | From: Mladen Gogala | Date: 2010-12-01 16:49:02 |
| Subject: Clarification, please |