Changes between Version 3 and Version 4 of Ticket #37474


Ignore:
Timestamp:
Nov 3, 2026, 4:53:12 PM (65 minutes ago)
Author:
cheek-walnut
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #37474 – Description

    v3 v4  
    3434Expected: both evaluations return `[{'title': 'b1'}, {'title': 'b2'}]`, as on Django 5.1.
    3535
    36 Regression in 65ad4ade74dc9208b9d686a451cd6045df0c9c3a (Refs #28900): the queries work on its parent and fail on it. Reproduced on 5.2.19, 6.0.10, 6.1.3 and main with SQLite; 5.1.16 is not affected.
     36Regression in 65ad4ade74dc9208b9d686a451cd6045df0c9c3a (Refs #28900): the queries work on its parent and fail on it. Reproduced on 5.2.19, 6.0.10, 6.1.3 and main with SQLite, and on main with PostgreSQL 16; 5.1.15 is not affected.
    3737
    38 The cause appears to be that `Query.clone()` (django/db/models/sql/query.py:387-395) doesn't copy the `selected` dict, so clones share it, while `Query.add_select_col()` (:2265, called from `SQLCompiler.get_order_by()` at compiler.py:544 for combined queries) mutates it in place and each clone keeps its own `select` tuple. This is different from #37466, which is about composite primary keys.
     38The cause appears to be that `Query.clone()` (django/db/models/sql/query.py:387-395 at 5bd95c57a2) doesn't copy the `selected` dict, so clones share it, while `Query.add_select_col()` (:2265, called from `SQLCompiler.get_order_by()` at compiler.py:544 for combined queries) mutates it in place and each clone keeps its own `select` tuple. This is different from #37466, which is about composite primary keys.
    3939
    40 AI disclosure: found during a code audit with Claude Code 2.1.317 (Claude Opus 5.5), which also reduced the test case and ran it on the versions above and on 65ad4ade74 and its parent. I reviewed this report and re-ran the reproduction on main and 5.1.16.
     40AI disclosure: found during a code audit with Claude Code 2.1.317 (Claude Opus 5.5), which also reduced the test case and ran it on the versions above and on 65ad4ade74 and its parent. I reviewed this report and re-ran the reproduction on main and stable/5.1.x.
Back to Top