Module

x/kysely_postgrs_js_dialect/mod.ts>kysely.InsertQueryBuilder#onDuplicateKeyUpdate

Kysely dialect for PostgreSQL using the Postgres.js client.
Latest
method kysely.InsertQueryBuilder.prototype.onDuplicateKeyUpdate
import { kysely } from "https://dotland.deno.dev/x/kysely_postgrs_js_dialect@v0.27.4/mod.ts";
const { InsertQueryBuilder } = kysely;

Adds on duplicate key update to the query.

If you specify on duplicate key update, and a row is inserted that would cause a duplicate value in a unique index or primary key, an update of the old row occurs.

This is only implemented by some dialects like MySQL. On most dialects you should use {@link onConflict} instead.

Examples

await db
  .insertInto('person')
  .values(values)
  .onDuplicateKeyUpdate({ species: 'hamster' })

Parameters

update: UpdateObjectExpression<DB, TB, TB>