Changes between Version 3 and Version 4 of Ticket #37474
- Timestamp:
- Nov 3, 2026, 4:53:12 PM (65 minutes ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #37474 – Description
v3 v4 34 34 Expected: both evaluations return `[{'title': 'b1'}, {'title': 'b2'}]`, as on Django 5.1. 35 35 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.16is not affected.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, and on main with PostgreSQL 16; 5.1.15 is not affected. 37 37 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.38 The 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. 39 39 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.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 stable/5.1.x.