#23758: Going beyond 5 levels of subqueries causes AssertionError in bump_prefix
-------------------------------------+-------------------------------------
     Reporter:  richardhowardsparx   |      Owner:  nobody
         Type:  Bug                  |     Status:  new
    Component:  Database layer       |    Version:  1.7
  (models, ORM)                      |   Keywords:  bump_prefix subquery
     Severity:  Normal               |  alias
 Triage Stage:  Unreviewed           |  Has patch:  0
Easy pickings:  0                    |      UI/UX:  0
-------------------------------------+-------------------------------------
 Regression from Django 1.6

 The following code in the interactive shell will reproduce the issue:

 {{{#!python
 from django.contrib.auth.models import User
 i = 0
 x = User.objects.filter(pk=1)
 while True:
     x = User.objects.filter(pk__in=x)
     i+=1
 }}}
 In django 1.7 it will throw the following AssertionError

 {{{#!python
 ...
 ... in bump_prefix(self, outer_query)
     829         while self.alias_prefix in self.subq_aliases:
     830             self.alias_prefix = chr(ord(self.alias_prefix) + 1)
 --> 831             assert self.alias_prefix < 'Z'
     832         self.subq_aliases =
 self.subq_aliases.union([self.alias_prefix])
     833         outer_query.subq_aliases =
 outer_query.subq_aliases.union(self.subq_aliases)

 AssertionError:
 }}}

 while in django 1.6 it will loop infinitely.

 I have tested this using multiple models in the loop, with the same
 outcome.

--
Ticket URL: <https://code.djangoproject.com/ticket/23758>
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/061.dc55cce3fe09152c460c01e614d46078%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to