Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - <para>
- - <command>INSERT</command> with an <literal>ON CONFLICT DO UPDATE</>
- - clause is a <quote>deterministic</quote> statement. This means
- - that the command will not be allowed to affect any single existing
- - row more than once; a cardinality violation error will be raised
- - when this situation arises. Rows proposed for insertion should not
- - duplicate each other in terms of attributes constrained by the
- - conflict-arbitrating unique index. Note that the ordinary rules
- - for unique indexes (and exclusion constraints) with regard to null
- - apply analogously to whether or not an arbitrating index indicates
- - if the alternative path should be taken. This means that when a
- - null value appears in any constrained tuple's column in an
- - <command>INSERT</command> statement with <literal>ON
- - CONFLICT</literal>, rows proposed for insertion will never take the
- - alternative path (provided that the column appears in the
- - arbitrating index's definition, and provided that a <literal>BEFORE
- - ROW INSERT</literal> trigger does not make null values non-null
- - before insertion); the statement will always insert, assuming
- - there is no unrelated error. Note that merely locking a row with
- - <literal>ON CONFLICT DO UPDATE</> (and not updating due to the row
- - not satisfying the <literal>WHERE</> clause
- - <replaceable>condition</>) does not count towards whether or not
- - the row has been affected multiple times (and whether or not a
- - cardinality violation error is raised). However, the
- - implementation checks for cardinality violations after locking the
- - row, and before <emphasis>considering</emphasis> updating, so a
- - cardinality violation may be raised despite the fact that the row
- - would not otherwise have gone on to be updated.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement