Skip to content

docs: clarify onConflictDoNothing batch behavior - #703

Open
raphaelbadia wants to merge 1 commit into
drizzle-team:mainfrom
raphaelbadia:docs/clarify-on-conflict-do-nothing-batch
Open

docs: clarify onConflictDoNothing batch behavior#703
raphaelbadia wants to merge 1 commit into
drizzle-team:mainfrom
raphaelbadia:docs/clarify-on-conflict-do-nothing-batch

Conversation

@raphaelbadia

@raphaelbadia raphaelbadia commented Jul 31, 2026

Copy link
Copy Markdown

What

Clarifies the On conflict do nothing section of the insert docs for pg, sqlite and cockroach.

Why

Closes drizzle-team/drizzle-orm#4065.

The previous wording said onConflictDoNothing "will cancel the insert if there's a conflict", which is misleading for multi-row inserts. In reality, only the conflicting rows are skipped, and the remaining rows are still inserted.

Verification

Ran the same scenario (one existing row id=1, then a batch insert of (1),(2),(3) with ON CONFLICT DO NOTHING) against real databases:

Database Result
PostgreSQL 16 INSERT 0 2 → existing id=1 kept, id=2 and id=3 inserted
CockroachDB same
SQLite same

In every case only the conflicting row was skipped and the rest were inserted.

Changes

  • Reworded the description in the three dialect docs.
  • Added a batch-insert example that makes the behavior explicit.

Reword the 'On conflict do nothing' section for pg, sqlite and cockroach.
The previous wording ('will cancel the insert if there's a conflict') was
misleading: on a multi-row insert only the conflicting rows are skipped,
the remaining rows are still inserted. Add a batch example.

Verified against PostgreSQL 16, CockroachDB and SQLite.

Closes #4065
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DOCS]: Clarify behavior of onConflictDoX when inserting multiple values at once

1 participant