#12717: query.as_sql crashes with multi-db and master/slave routing
------------------------------------------+---------------------------------
 Reporter:  jbalogh                       |       Owner:  nobody    
   Status:  new                           |   Milestone:            
Component:  Database layer (models, ORM)  |     Version:  1.2-alpha 
 Keywords:                                |       Stage:  Unreviewed
Has_patch:  0                             |  
------------------------------------------+---------------------------------
 To trigger this, you need a "default" and an "other" database setup, and
 they both can't be sqlite.

 When you call __str__ on a QuerySet.Query object, it doesn't know about
 QuerySet.db so it falls back to the default database.  But the subquery
 knows what database to use (other), so the subquery compiles against a
 different database than the parent.

 Attaching a failing test.  The fix is probably to push ``using`` down to
 the Query, but I'm not sure.

 The easy workaround is to call Query.get_compiler().as_sql with the
 correct using parameter.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/12717>
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to