encode / django-rest-framework

Web APIs for Django. 🎸
https://www.django-rest-framework.org
Other
28.21k stars 6.81k forks source link

UniqueTogetherValidator does not comply to Database standards #9370

Closed gabn88 closed 5 months ago

gabn88 commented 5 months ago

Checklist

If you have a database unique constraint that includes a nullable field, DRF will still raise an 'field_A and field_B must make a unique set' validationerror when you try to post a new nullable field. Whereas on database level every NULL is considered unique.

Could be fixed maybe here in the code: https://github.com/encode/django-rest-framework/blob/63063da0820e23ef0edbf92a3031103a6c2ce254/rest_framework/validators.py#L123