﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
36299	ORM Regressions in Django 5.2	OutOfFocus4		"ORM calls that worked prior to Django 5.2 now return different results or outright fail in Django 5.2. I have attached a file with proof-of-concept tests.

The first issue I noticed is that calling `alias` on after `values_list` adds the aliased value to the result set. I believe the root of this error is in `django/db/models/sql/query.py` lines 1224 and 1225:

{{{#!python
        if self.selected:
            self.selected[alias] = alias
}}}

This code adds the alias to `selected` regardless of the value of the `select` parameter.

Another issue I found causes queryset evaluation to raise an `AttributeError` if the database backend supports `SELECT ... FOR UPDATE`. The following code:

{{{#!python
with atomic():
    values = (
        User.objects.select_for_update(of=(""self"",))
        .values_list(
            Concat(F(""first_name""), Value("" ""), F(""last_name"")), ""email""
        )
        .get(pk=12)
    )
}}}

will fail with a stacktrace ending in `AttributeError: 'Concat' object has no attribute 'target'` using the `postgresql` DB backend."	Bug	new	Database layer (models, ORM)	5.2	Normal				Unreviewed	0	0	0	0	0	0
