Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
miketromba opened this issue Feb 4, 2025 · 0 comments
Open
1 task done
Labels
docs Improvements or additions to documentation

Comments

@miketromba
Copy link

miketromba commented Feb 4, 2025

Enhancement hasn't been filed before.

  • I have verified this enhancement I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

The docs currently suggest that the onConflictDoNothing method "cancels the insert" when a conflict is found - but the docs only include examples for single insert - not multiple value inserts.

Does this mean that if I am inserting a batch of 100 records and one of them has a conflict, the entire insert (of all 100 records) is canceled? Or do the other 99 still get inserted?

E.g.

await db.insert(table)
    .values(arrayOf100ValuesWithOneConflict)
    .onConflictDoNothing()

// Do 99 or 0 records get inserted? - Docs should mention this

I suggest updating the docs to clarify what the behavior is.

Edit: Based on quick, rough testing, it appears that the entire batch of inserts is cancelled if there are any conflicts within the batch - would be nice to have this explicitly stated in the docs.

@miketromba miketromba added the docs Improvements or additions to documentation label Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant