Skip to content

Commit

Permalink
Refs #33996 -- Updated CheckConstraint validation on NULL values on O…
Browse files Browse the repository at this point in the history
…racle 23c+.

Oracle 23c supports comparing boolean expressions.
  • Loading branch information
felixxm committed Mar 15, 2024
1 parent cbf1e87 commit 36a0008
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion django/db/backends/oracle/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ class DatabaseFeatures(BaseDatabaseFeatures):
supports_slicing_ordering_in_compound = True
requires_compound_order_by_subquery = True
allows_multiple_constraints_on_same_fields = False
supports_comparing_boolean_expr = False
supports_json_field_contains = False
supports_collation_on_textfield = False
test_now_utc_template = "CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"
Expand Down Expand Up @@ -174,6 +173,10 @@ def supports_frame_exclusion(self):
def supports_boolean_expr_in_select_clause(self):
return self.connection.oracle_version >= (23,)

@cached_property
def supports_comparing_boolean_expr(self):
return self.connection.oracle_version >= (23,)

@cached_property
def supports_aggregation_over_interval_types(self):
return self.connection.oracle_version >= (23,)
Expand Down
6 changes: 3 additions & 3 deletions docs/ref/models/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ ensures the age field is never less than 18.
name="age_gte_18_and_others",
)

.. admonition:: Oracle
.. admonition:: Oracle < 23c

Checks with nullable fields on Oracle must include a condition allowing for
``NULL`` values in order for :meth:`validate() <BaseConstraint.validate>`
Checks with nullable fields on Oracle < 23c must include a condition
allowing for ``NULL`` values in order for :meth:`~BaseConstraint.validate`
to behave the same as check constraints validation. For example, if ``age``
is a nullable field::

Expand Down

0 comments on commit 36a0008

Please sign in to comment.