Changes between Initial Version and Version 3 of Ticket #37474


Ignore:
Timestamp:
Nov 3, 2026, 4:38:04 PM (81 minutes ago)
Author:
cheek-walnut
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #37474

    • Property Summary Combined queries with values() ordered by a non-selected field crash with IndexError after a clone is → Combined queries with values() ordered by a non-selected field crash after a clone is evaluated
    • Property Version 6.1 → 5.2
  • Ticket #37474 – Description

    initial v3  
    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.20, 6.0.11, 6.1.4 and main (5bd95c57a2) 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; 5.1.16 is not affected.
    3737
    3838The 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.
Back to Top