﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
20874	Nested subqueries have conflicting alias prefixes	Anssi Kääriäinen	nobody	"Currently the ORM has a way to bump table alias prefixes for subqueries. This means that for example alias T0 would be turned to U0. Unfortunately the current way doesn't work when nesting multiple queries, that is in cases like:
{{{
qs1 = MyModel.objects.all()
qs2 = MyModel.objects.filter(pk__in=qs1)
qs3 = MyModel.objects.filter(pk__in=qs2)
}}}
for qs2 the qs1 gets bumped to U-prefixes. But qs2 gets bumped *again* to U-prefixes in qs3. Luckily this doesn't usually matter that much in current Django, as for example ""u0.id IN (SELECT u0.id FROM sometable u0) does work. Later on, if EXISTS queries are going to be more common this will become more important as ""WHERE EXISTS (SELECT ... WHERE u0.id = u0.id) doesn't work at all."	Bug	closed	Database layer (models, ORM)	dev	Normal	fixed			Ready for checkin	1	0	0	0	0	0
