Module upsert

Source
Expand description

Types and functions related to PG’s and Sqlite’s ON CONFLICT clause

Upsert is currently supported by diesel for the following database systems:

  • PostgreSQL version 9.5 or newer
  • Sqlite3 version 3.24.0 or newer
  • MySQL version 5.7 or newer

See the methods on InsertStatement for usage examples.

Constructing an upsert statement from an existing select statement requires a where clause on sqlite due to a ambiguity in their parser. See the corresponding documentation for details.

Structs§

IncompleteDoUpdate
A partially constructed ON CONFLICT DO UPDATE clause.
IncompleteOnConflict
A partially constructed ON CONFLICT clause.

Traits§

DecoratableTarget
Interface to add information to conflict targets. Designed to be open for further additions to conflict targets like constraints

Functions§

excluded
Represents excluded.column in an ON CONFLICT DO UPDATE clause.
on_constraintpostgres_backend
Used to specify the constraint name for an upsert statement in the form ON CONFLICT ON CONSTRAINT. Note that constraint_name must be the name of a unique constraint, not the name of an index.