#10847: `QuerySet.values` doesn't remove extra selections.
---------------------------------------------------+------------------------
          Reporter:  mrmachine                     |         Owner:  nobody     
                     
            Status:  new                           |     Milestone:  1.1        
                     
         Component:  Database layer (models, ORM)  |       Version:  SVN        
                     
        Resolution:                                |      Keywords:  queryset 
extra select values sql
             Stage:  Accepted                      |     Has_patch:  1          
                     
        Needs_docs:  0                             |   Needs_tests:  0          
                     
Needs_better_patch:  1                             |  
---------------------------------------------------+------------------------
Comment (by mrmachine):

 Are you sure about tests 1-3 working if `extra()` comes before `values()`?
 When I run test 2-3 (with User as the model) I get failures, with r10581.

 {{{
 >>> from django.contrib.auth.models import User
 >>> User.objects.extra(select={'extra': 1}).values('pk').query.as_sql()
 (u'SELECT (1) AS "extra", "auth_user"."id" FROM "auth_user"', ())
 >>> User.objects.filter(pk__in=User.objects.extra(select={'extra_col':
 1}).values('pk'))
 Traceback (most recent call last):
 ...
 OperationalError: only a single result allowed for a SELECT that is part
 of an expression
 }}}

 The above is with SQLite, but I get the same result with PostgreSQL, just
 with a different exception (`ProgrammingError: subquery has too many
 columns`). I think that test 1 is also executing the extra selection, but
 just not passing it through to the output.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/10847#comment:4>
Django <http://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 post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to