Skip to content

Possible IntegrityError even with UniqueValidator #3876

Closed
@cancan101

Description

@cancan101

Even if a Serializer field is using UniqueValidator (likewise for UniqueTogetherValidator) there is still a race where after the check is performed, a conflicting row may be added to the DB. Right now that results in a 500 error with something like the following:

Exception Type: IntegrityError at /api/xxx/
Exception Value: UNIQUE constraint failed:  ...

I suggest in these cases DFF return a 409 with a generic error message. At the very least there should be some opt in behavior to get this.

I do think this logic should be handled by the framework rather than by the application.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions