#21903: Query with select_related and defer on MySQL causes id field to be 
returned
as bool
-------------------------------------+-------------------------------------
     Reporter:  matklad              |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  1.6
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:  Ready for
     Keywords:                       |  checkin
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by akaariai):

 * component:  Uncategorized => Database layer (models, ORM)
 * stage:  Unreviewed => Ready for checkin


Comment:

 Seems like patch 9918c11114ac3ec9622631558ef26ebf3919cb69 (#21413) should
 be backpatched from master. I don't recall why I didn't do that
 originally, maybe I just forgot to do that.

 See
 
https://github.com/akaariai/django/compare/django:stable%2F1.6.x...ticket_21903_16
 for a branch having tests for this ticket + backpatch of #21413. I think
 that there isn't point in adding this ticket's tests. The backpatch has a
 much simpler test case. I'll mark this RFC, but I'll wait a little bit for
 possible reviewers.

 As for why these bugs happen - the compiler.resolve_columns() is trying to
 mimic what SELECT clause generation is doing. And, unfortunately the
 SELECT clause generation is complex (caused by defer, select_related,
 annotations and extra). In the long term we should probably move to
 something where select setup generates a list of "col_sql, alias, field",
 and then resolve_columns could just use that list.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/21903#comment:3>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.63369ae35462749c194e35978c21f7ad%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to