UniqueConstraint and database order of operations

Hi,

I am using Django 5.1 and in my model I am using UniqueConstraint on a particular field of that model. Each object in the queryset has a value for that field that has the constraint. There’s also form validation that’s added to check for duplicates. What I’m doing is updating one of the earlier objects’ constrainted field in the queryset, saving, then seeing the expected form error. I then try to delete one of the later objects that has the same constrained field value but instead of getting the expected form error, I am getting IntegrityError when I try to save.

Does this occur because the uniqueness is checked first before the deletion of the object?