1
0
mirror of https://github.com/django/django.git synced 2025-03-12 10:22:37 +00:00

[5.2.x] Refs #373 -- Delegated Tuple compilation to compiler.

This should allow third-party backends to define Tuple.as_vendor()
overrides that are taken into consideration which calling as_sql()
directly prevents.

Backport of c326cfe3b1683e6c205f53a4ad11feba6623a399 from main
This commit is contained in:
Simon Charette 2025-02-08 21:05:50 -05:00 committed by Mariusz Felisiak
parent 0690c06013
commit 1ec20a8e84

View File

@ -87,7 +87,7 @@ class TupleLookupMixin:
Value(val, output_field=col.output_field)
for col, val in zip(self.lhs, self.rhs)
]
return Tuple(*args).as_sql(compiler, connection)
return compiler.compile(Tuple(*args))
else:
sql, params = compiler.compile(self.rhs)
if not isinstance(self.rhs, ColPairs):
@ -313,7 +313,7 @@ class TupleIn(TupleLookupMixin, In):
)
)
return Tuple(*result).as_sql(compiler, connection)
return compiler.compile(Tuple(*result))
def as_sql(self, compiler, connection):
if not self.rhs_is_direct_value():