Broken transaction after checking for uniqueness #8651
Unanswered
smalash
asked this question in
Potential Issue
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I created a simple project with one application and a model.
https://github.com/SergeyMalash/test_unique
It has two unique fields.
Also in the settings I specified ATOMIC_REQUESTS
When I make a POST request with an invalid IP address, an error occurs (screenshot)
My assumptions:
As far as I understand, during the check for uniqueness, a DataError exception occurs, since postgres can't compare inet field with an incorrect IP address
This breaks all subsequent calls to the database.
https://github.com/encode/django-rest-framework/blob/master/rest_framework/validators.py#L71
Am I right?
How can this be fixed?
I need to leave ATOMIC_REQUESTS enabled
My issue is partially related to #3381
But I didn't find a solution there.
https://pastebin.com/bDuQvje4

https://pastebin.com/7VaWjMaZ
Beta Was this translation helpful? Give feedback.
All reactions