OnConflict Type
What an insert does when the row would break a primary key or a unique constraint or index.
Set on each row before SubmitUpdates; rows of one submit may differ. Databases without an upsert
(SQL Server, Oracle, Firebird, ODBC, MS Access) ignore Update and DoNothing and refuse
DoNothingOn and UpdateOn. A row inserted without its key reads the key the database gave it; after a
conflict it reads the existing row's key when that row was updated, and none when it was left as it was.
Union cases
| Union case |
Description
|
Full Usage:
DoNothing
|
The existing row stays as it is, whichever unique constraint the new row breaks.
PostgreSQL and DuckDB: |
Full Usage:
DoNothingOn conflictColumns
Parameters:
string list
-
The constraint's or index's columns, as the table has them (matched ignoring case);
a partial index can't be named, so use DoNothing for one. A column named twice is refused.
|
The existing row stays as it is when the new row breaks the unique constraint or index on exactly these
columns: PostgreSQL, SQLite 3.24+ and DuckDB; MySQL refuses it.
|
Full Usage:
Throw
|
The insert fails with the database's error (the default). |
Full Usage:
Update
|
The existing row gets every column the new row sets.
PostgreSQL: |
Full Usage:
UpdateOn(onColumns, updates)
Parameters:
string list
-
The constraint's or index's columns, as the table has them (matched ignoring case).
updates : ConflictUpdate list
-
What each named column becomes: the inserted value or a constant (null clears the column).
The columns not named keep their old values; a column named twice is refused.
|
The existing row changes when the new row breaks the unique constraint or index on exactly
PostgreSQL, SQLite 3.24+ and DuckDB; MySQL refuses it.
|
Instance members
| Instance member |
Description
|
Full Usage:
this.IsDoNothing
Returns: bool
|
|
Full Usage:
this.IsDoNothingOn
Returns: bool
|
|
Full Usage:
this.IsThrow
Returns: bool
|
|
Full Usage:
this.IsUpdate
Returns: bool
|
|
Full Usage:
this.IsUpdateOn
Returns: bool
|
|