| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> | 
|---|---|
| To: | rasmus(at)mindplay(dot)dk | 
| Cc: | pgsql-bugs(at)postgresql(dot)org | 
| Subject: | Re: BUG #14596: False primary/unique key constraint violations | 
| Date: | 2017-03-22 14:45:07 | 
| Message-ID: | 31317.1490193907@sss.pgh.pa.us | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-bugs | 
rasmus(at)mindplay(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | bricklen | 2017-03-22 14:50:48 | Re: BUG #14596: False primary/unique key constraint violations | 
| Previous Message | 許耀彰 | 2017-03-22 14:35:15 | postgresql to mssql |