Opened 7 months ago
Closed 7 months ago
#35614 closed Bug (fixed)
SQLCompiler.as_subquery_condition shouldn't modify the query object
Description (last modified by ) ¶
SQLCompiler.as_subquery_condition
modifies the query object.
django/db/models/sql/compiler.py#L1619
self.query.where.add(RawSQL("%s = %s" % (lhs_sql, rhs), lhs_params), AND)
This is unfortunate, because whenever the query is re-compiled, it adds another condition.
I noticed the issue when inspecting .query
on a queryset. Each time I accessed .query
, a new condition appeared.
An example queryset can be found in test MultiColumnFKTests.test_double_nested_query
.
Change History (5)
comment:1 by , 7 months ago
Description: | modified (diff) |
---|---|
Has patch: | set |
comment:2 by , 7 months ago
Easy pickings: | unset |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:3 by , 7 months ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:4 by , 7 months ago
Note:
See TracTickets
for help on using tickets.
PR