﻿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
19500	Join reuse regression	Anssi Kääriäinen	nobody	"The commit 68847135bc9acb2c51c2d36797d0a85395f0cd35 for ticket #18748 caused a severe regression in join reuse. Chained filters for direct foreign keys do not reuse existing joins at all. For example
{{{
qs.filter(fk__somecol__gt=1).filter(fk__somecol__lt=10)
}}}
causes two joins instead of one.

The patch at https://github.com/akaariai/django/commit/688ec5aca2ca387774016aef78560c199d480b6c fixes the issue and adds various test for join reuse. It actually simplifies the code a little.

As a bonus we can now correctly reuse joins in chained filter() calls when using reverse o2o fields.

I think I will commit the patch soon as currently the code isn't behaving nicely."	Bug	closed	Database layer (models, ORM)	dev	Normal	fixed		charette.s@…	Accepted	1	0	0	1	0	0
