mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #33996 -- Fixed CheckConstraint validation on NULL values.
Bug in 667105877e.
Thanks James Beith for the report.
This commit is contained in:
committed by
Mariusz Felisiak
parent
b731e88415
commit
e14d08cd89
@@ -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.
|
||||
|
||||
@@ -15,3 +15,6 @@ Bugfixes
|
||||
* Fixed a regression in Django 4.1 that caused aggregation over a queryset that
|
||||
contained an ``Exists`` annotation to crash due to too many selected columns
|
||||
(:ticket:`33992`).
|
||||
|
||||
* Fixed a bug in Django 4.1 that caused an incorrect validation of
|
||||
``CheckConstraint`` on ``NULL`` values (:ticket:`33996`).
|
||||
|
||||
Reference in New Issue
Block a user