Module

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

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

Changes an insert into query to an insert ignore into query.

If you use the ignore modifier, ignorable errors that occur while executing the insert statement are ignored. For example, without ignore, a row that duplicates an existing unique index or primary key value in the table causes a duplicate-key error and the statement is aborted. With ignore, the row is discarded and no error occurs.

This is only supported on some dialects like MySQL. On most dialects you should use the {@link onConflict} method.

Examples

await db.insertInto('person')
  .ignore()
  .values(values)
  .execute()