#36288: Regression in values_list() with duplicated field names
-------------------------------------+-------------------------------------
     Reporter:  Claude Paroz         |                    Owner:  (none)
         Type:  Bug                  |                   Status:  new
    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 Natalia Bidart):

 * cc: Simon Charette (added)
 * stage:  Unreviewed => Accepted

Comment:

 Thank you Claude for the report! I have reproduced with the following:
 {{{
 >>> import django
 >>> django.VERSION
 (6, 0, 0, 'alpha', 0)
 >>> [i for i in User.objects.all().values_list("username", "username")]
 [('admin',)]
 }}}

 Versus:
 {{{
 >>> import django
 >>> django.VERSION
 (5, 1, 7, 'final', 0)
 >>> from django.contrib.auth.models import User
 >>> [i for i in User.objects.all().values_list("username", "username")]
 [('admin', 'admin')]
 }}}

 Now, I'm not sure this is a bug? I mean there is certainly a change in
 behavior, but to me the 5.1 result feels "buggy", so in a way this "was
 fixed" in 5.2.
 On the other hand, the DB query does duplicate the columns so perhaps this
 *is* a regression:
 {{{#!sql
 psql (16.8 (Ubuntu 16.8-0ubuntu0.24.04.1))
 Type "help" for help.

 djangotest=# select username, username from auth_user;
  username | username
 ----------+----------
  admin    | admin
 (1 row)
 }}}

 Claude, could you indulge me and share in the ticket the use case for
 getting the repeated fields in the `values_list` result? Accepting in the
 meantime.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36288#comment:1>
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/01070195f8328183-c1fe24fe-0430-4bab-86b9-03a9642a6a7e-000000%40eu-central-1.amazonses.com.

Reply via email to