Skip to content

Failed UNIQUE constraint does not return gorm error #90

@re-cheid

Description

@re-cheid

Scenario:
A table which has fields with UNIQUE constraint.
Try to insert a new entry with the same value for the UNIQUE field as an already existing entry.

Expected result:
Returned error being gorm.ErrDuplicatedKey

Actual result:
Returned error is from sqlite3: constraint failed: UNIQUE constraint failed: table.field(2067) which is clumsy to react to in code

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