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

ConflictOption does not work with postgres DB #1701

Open
jordinl opened this issue Mar 7, 2025 · 0 comments
Open

ConflictOption does not work with postgres DB #1701

jordinl opened this issue Mar 7, 2025 · 0 comments

Comments

@jordinl
Copy link

jordinl commented Mar 7, 2025

Trying bulk insert on a table with a unique constraint

await dbContext.BulkInsertAsync(collection,
    new BulkConfig { ConflictOption = ConflictOption.Ignore },
    cancellationToken: stoppingToken);

getting error

duplicate key value violates unique constraint "ix_foo"

It seems that the conflict option is only implemented for mysql: https://github.com/search?q=repo%3Aborisdj%2FEFCore.BulkExtensions+conflictoption&type=code

Postgres has an "ON CONFLICT DO (NOTHING|UPDATE)" clause: https://www.postgresql.org/docs/current/sql-insert.html

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

No branches or pull requests

1 participant