Skip to content

ConflictOption does not work with postgres DB #1701

Open
@jordinl

Description

@jordinl

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions