#36299: Calling alias after values_list adds the aliased value to the result set
-------------------------------------+-------------------------------------
Reporter: OutOfFocus4 | Owner: Simon
| Charette
Type: Bug | Status: assigned
Component: Database layer | Version: 5.2
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):
* summary: ORM Regressions in Django 5.2 =>
Calling alias after values_list adds the aliased value to the result
set
Comment:
Thank you for the report
Simon you're too quick!
{{{#!diff
diff --git a/tests/queries/tests.py b/tests/queries/tests.py
index c429a93af3..f9e831da15 100644
--- a/tests/queries/tests.py
+++ b/tests/queries/tests.py
@@ -7,7 +7,7 @@ from operator import attrgetter
from django.core.exceptions import EmptyResultSet, FieldError,
FullResultSet
from django.db import DEFAULT_DB_ALIAS, connection
from django.db.models import CharField, Count, Exists, F, Max, OuterRef,
Q
-from django.db.models.expressions import RawSQL
+from django.db.models.expressions import RawSQL, Value
from django.db.models.functions import ExtractYear, Length, LTrim
from django.db.models.sql.constants import LOUTER
from django.db.models.sql.where import AND, OR, NothingNode, WhereNode
@@ -2737,6 +2737,10 @@ class ValuesQuerysetTests(TestCase):
qs = qs.values_list("num")
self.assertSequenceEqual(qs, [(72,)])
+ def test_values_list_with_alias(self):
+ qs = Number.objects.values_list("num").alias(extra=Value(1))
+ self.assertSequenceEqual(qs, [(72,)])
+
def test_flat_extra_values_list(self):
# testing for ticket 14930 issues
}}}
Replicated the alias issue and confirmed it's a regression in
65ad4ade74dc9208b9d686a451cd6045df0c9c3a
If select_for_update is a separate issue, we should create a separate
ticket
--
Ticket URL: <
https://code.djangoproject.com/ticket/36299#comment:3>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.