Leaklens

django__django-11797

Filtering on query result overrides GROUP BY of internal query

Verdict: the fix is stated in the issue (Tier A).

We probably don't want to perform the clear_select_clause and add_fields(['pk']) when the query is already selecting fields. That's exactly what In.process_rhs ​does already by only performing these operations if not getattr(self.rhs, 'has_select_fields', True).

The text states the fix: “We probably don't want to perform the clear_select_clause and add_fields(['pk']) when the query is already selecting fields. That's exactly what In.process_rhs ​does alr…”

All SWE-bench Lite tasks · more django/django tasks · How the check works