summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorDavid Sanders <shang.xiao.sanders@gmail.com>2022-09-09 00:02:58 +1000
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-09-13 14:06:46 +0200
commitbe5e3b46f78d54f8fae5dc255295d771c2becaac (patch)
treed084aba8e55ca4d64f6857ac28088adba70b9e6c /docs/ref
parent148d60de741e16b5185fb517fc24c6bf5e5f705e (diff)
[4.1.x] Fixed #33996 -- Fixed CheckConstraint validation on NULL values.
Bug in 667105877e6723c6985399803a364848891513cc. Thanks James Beith for the report. Backport of e14d08cd894e9d91cb5d9f44ba7532c1a223f458 from main
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/models/constraints.txt9
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/ref/models/constraints.txt b/docs/ref/models/constraints.txt
index 9b1e110f85..b52f754294 100644
--- a/docs/ref/models/constraints.txt
+++ b/docs/ref/models/constraints.txt
@@ -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.