From 18adbb636320e038627947ec9a91ddd2e64c4447 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Wed, 19 Dec 2007 10:58:26 +0000 Subject: queryset-refactor: Fixed the way join promotions are done when joining queries (particularly the disjunctive -- 'OR' -- case). This fixes a FIXME and produces better queries. git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6958 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/queries/models.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests') diff --git a/tests/regressiontests/queries/models.py b/tests/regressiontests/queries/models.py index 5af1a19e62..3c070a86ce 100644 --- a/tests/regressiontests/queries/models.py +++ b/tests/regressiontests/queries/models.py @@ -308,6 +308,11 @@ True >>> len(qs.query.alias_map) 3 +Similarly, when one of the joins cannot possibly, ever, involve NULL values (Author -> ExtraInfo, in the following), it should never be promoted to a left outer join. So hte following query should only involve one "left outer" join (Author -> Item is 0-to-many). +>>> qs = Author.objects.filter(id=a1.id).filter(Q(extra__note=n1)|Q(item__note=n3)) +>>> len([x[2][2] for x in qs.query.alias_map.values() if x[2][2] == query.LOUTER]) +1 + Bug #2091 >>> t = Tag.objects.get(name='t4') >>> Item.objects.filter(tags__in=[t]) -- cgit v1.3