Yah, that does look bizarre.  I have no idea what is going on but am a
sucker for puzzles so tried to make some sense of the select.  My
feeling is the problem isn't in the StagedOrder class that you posted
but rather one of the ones getting pulled in as a result of the
StagingArea ForeignKey.

The list of tables involved starts like this:

staging_area ->
location -> (2) region -> country -> world_region ->
     region6 -> country7 -> world_region8 ->
order ->
customer ->
title ->
gender -> region13 -> country14 -> world_region15 ->
     region16 -> country17 -> world_region18 ->
message_type -> etc. etc. etc.

So staging_area pulls in location and then location seems to have two
fields that could be region ForeignKeys.  Region apparently points to a
country and country then to world_region.  OK so far.  Then (to handle
2nd region ForeignKey found in location?) the sixth table is added to
the select: region6, followed by country7 and world_region8.  Shouldn't
these have been recognized as tables already in the select?  Things
continue with order, customer, title, gender, oops here's another
region, and we're up to the 13th table in the select.  So a bunch more
tables are added that are really already named as part of the select,
only this time they're given a number suffix that matches what table
number they are in the select statement.  Eventually we get up to table
number 82, a customer table, which gives a loop. I guess it kept adding
"new" tables until it hit the limit mentioned in the exception.

Like I said I have no idea what's going on -- I'm just a casual user
and am on a pretty recent code base -- but maybe these observations
will trigger someone who knows a bit more to say "oh yeah, I know what
that problem is".  Maybe search the list/problem database for issues
with multiple ForeignKey fields in a model pointing to the same table?
I have a vague feeling I might have seen some messages about stuff like
that fly by but I could easily be wrong about that.

Karen


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to