#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
-------------------------------------+-------------------------------------
Comment (by Sarah Boyce):
Replicated the second issue, also a regression in
65ad4ade74dc9208b9d686a451cd6045df0c9c3a
{{{#!diff
diff --git a/tests/select_for_update/tests.py
b/tests/select_for_update/tests.py
index e8ba8f8b6e..18fca277cb 100644
--- a/tests/select_for_update/tests.py
+++ b/tests/select_for_update/tests.py
@@ -13,6 +13,8 @@ from django.db import (
router,
transaction,
)
+from django.db.models import F, Value
+from django.db.models.functions import Concat
from django.test import (
TransactionTestCase,
override_settings,
@@ -122,6 +124,17 @@ class SelectForUpdateTests(TransactionTestCase):
list(Person.objects.select_for_update(no_key=True))
self.assertIs(self.has_for_update_sql(ctx.captured_queries,
no_key=True), True)
+ @skipUnlessDBFeature("has_select_for_update_of")
+ def test_for_update_of_values_list(self):
+ with transaction.atomic():
+ values = (
+ Person.objects.select_for_update(
+ of=("self",),
+ )
+ .values_list(Concat(Value("Dr. "), F("name")), "born")
+ ).get(pk=self.person.pk)
+ self.assertTupleEqual(values, ("Dr. Reinhardt", self.city1.pk))
+
@skipUnlessDBFeature("has_select_for_update_of")
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36299#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/01070196012e421b-9ce8f83d-84be-4838-a213-f9da996555be-000000%40eu-central-1.amazonses.com.