query.lookup_inner doesn't update tables
|Reported by:||anonymous||Owned by:||Adrian Holovaty|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
django.db.models.query.lookup_inner returns a (tables,joins,where,params) tuple. After staring at this 140-line piece of spaggeti code, I'm still unsure of what and why it does what it does, but for one thing, the returned tables list is always empty. The only place where tables is modified is at the line " tables.extend(tables2)", but tables2 is the returned tables list from a recursive call of lookup_inner. There should be a tables.append(sometable) somewhere, just like where and params. If this is not a bug and tables should in fact always be empty, what's the point of returning it ?
So, how about taking the chance to refactor things a little when this is fixed ?