summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2025-01-12 18:23:06 -0500
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-01-13 11:14:01 +0100
commit76a0b6aa3aa7bd62c2a9ba11306c906047ee7ada (patch)
tree59276197cab2b2e05a13817c9673999761796a87
parent9e552015556661d183a999078a9e846200ef6765 (diff)
Refs #36050 -- Fixed OuterRef support for CompositePrimaryKey on Oracle.
Oracle doesn't support native tuple comparison so each as_oracle implementation of tuple lookups must also perform right-hand-side sanitization.
-rw-r--r--django/db/models/fields/tuple_lookups.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/django/db/models/fields/tuple_lookups.py b/django/db/models/fields/tuple_lookups.py
index 2f195f25b9..ffab95a370 100644
--- a/django/db/models/fields/tuple_lookups.py
+++ b/django/db/models/fields/tuple_lookups.py
@@ -99,6 +99,8 @@ class TupleLookupMixin:
class TupleExact(TupleLookupMixin, Exact):
def as_oracle(self, compiler, connection):
+ # Process right-hand-side to trigger sanitization.
+ self.process_rhs(compiler, connection)
# e.g.: (a, b, c) == (x, y, z) as SQL:
# WHERE a = x AND b = y AND c = z
lookups = [Exact(col, val) for col, val in zip(self.lhs, self.rhs)]
@@ -131,6 +133,8 @@ class TupleIsNull(TupleLookupMixin, IsNull):
class TupleGreaterThan(TupleLookupMixin, GreaterThan):
def as_oracle(self, compiler, connection):
+ # Process right-hand-side to trigger sanitization.
+ self.process_rhs(compiler, connection)
# e.g.: (a, b, c) > (x, y, z) as SQL:
# WHERE a > x OR (a = x AND (b > y OR (b = y AND c > z)))
lookups = itertools.cycle([GreaterThan, Exact])
@@ -157,6 +161,8 @@ class TupleGreaterThan(TupleLookupMixin, GreaterThan):
class TupleGreaterThanOrEqual(TupleLookupMixin, GreaterThanOrEqual):
def as_oracle(self, compiler, connection):
+ # Process right-hand-side to trigger sanitization.
+ self.process_rhs(compiler, connection)
# e.g.: (a, b, c) >= (x, y, z) as SQL:
# WHERE a > x OR (a = x AND (b > y OR (b = y AND (c > z OR c = z))))
lookups = itertools.cycle([GreaterThan, Exact])
@@ -183,6 +189,8 @@ class TupleGreaterThanOrEqual(TupleLookupMixin, GreaterThanOrEqual):
class TupleLessThan(TupleLookupMixin, LessThan):
def as_oracle(self, compiler, connection):
+ # Process right-hand-side to trigger sanitization.
+ self.process_rhs(compiler, connection)
# e.g.: (a, b, c) < (x, y, z) as SQL:
# WHERE a < x OR (a = x AND (b < y OR (b = y AND c < z)))
lookups = itertools.cycle([LessThan, Exact])
@@ -209,6 +217,8 @@ class TupleLessThan(TupleLookupMixin, LessThan):
class TupleLessThanOrEqual(TupleLookupMixin, LessThanOrEqual):
def as_oracle(self, compiler, connection):
+ # Process right-hand-side to trigger sanitization.
+ self.process_rhs(compiler, connection)
# e.g.: (a, b, c) <= (x, y, z) as SQL:
# WHERE a < x OR (a = x AND (b < y OR (b = y AND (c < z OR c = z))))
lookups = itertools.cycle([LessThan, Exact])