Fixed #33996 -- Fixed CheckConstraint validation on NULL values.

Bug in 667105877e.

Thanks James Beith for the report.
This commit is contained in:
David Sanders 2022-09-09 00:02:58 +10:00 committed by Mariusz Felisiak
parent b731e88415
commit e14d08cd89
7 changed files with 42 additions and 7 deletions

View file

@ -102,6 +102,15 @@ specifies the check you want the constraint to enforce.
For example, ``CheckConstraint(check=Q(age__gte=18), name='age_gte_18')``
ensures the age field is never less than 18.
.. admonition:: Oracle
Checks with nullable fields on Oracle must include a condition allowing for
``NULL`` values in order for :meth:`validate() <BaseConstraint.validate>`
to behave the same as check constraints validation. For example, if ``age``
is a nullable field::
CheckConstraint(check=Q(age__gte=18) | Q(age__isnull=True), name='age_gte_18')
.. versionchanged:: 4.1
The ``violation_error_message`` argument was added.