IF Commons GitHub

sql/physical/upsert

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0007-physical FR-008

The upsert (commons data 0007-physical FR-008): rows inserted, and the row that is there already updated, so that a load run twice leaves the same rows. The three dialects write it alike (INSERT ... ON CONFLICT (key) DO UPDATE SET ...), so the statement is made here, for bind's reference data and for the extensions that load tables of their own.

Source: commons/data/sql/physical/upsert.ts

0 of 1 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

upsertfunctionno test imports it
function upsert(dialect: Dialect, table: string, columns: readonly string[], key: readonly string[], rows: readonly (readonly Literal[])[], schema?: string | undefined): string

An upsert statement.

ParameterWhat it is
dialecthow the engine writes names and literals
tablethe table, as written
columnsthe columns, as written
keythe columns of the key, as written; the rest are updated where the key is there
rowsthe values of each row, in the order of the columns

Returns: the statement, ending in ;

Titles, headings, exports, tables, columns and requirements. Esc closes.