diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-08-17 22:38:36 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-08-17 22:38:36 +0000 |
| commit | 556fbc78a636d2be5c66a4393361476a6de091bc (patch) | |
| tree | 44f5b10671e5eb9a1691545daaa7e18df88aa9ca /tests/regressiontests/extra_regress | |
| parent | b25d759bed2d72982cf12f59c38dc3438e330da1 (diff) | |
Fixed #8039 -- Make sure that extra(tables=...) tables are always included in
the resulting SQL. Previously, an optimisation was removing them in some corner
cases.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8429 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/extra_regress')
| -rw-r--r-- | tests/regressiontests/extra_regress/models.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/regressiontests/extra_regress/models.py b/tests/regressiontests/extra_regress/models.py index 8c624defc4..500773d610 100644 --- a/tests/regressiontests/extra_regress/models.py +++ b/tests/regressiontests/extra_regress/models.py @@ -24,6 +24,10 @@ class RevisionableModel(models.Model): new_revision.pk = None return new_revision +class Order(models.Model): + created_by = models.ForeignKey(User) + text = models.TextField() + __test__ = {"API_TESTS": """ # Regression tests for #7314 and #7372 @@ -87,4 +91,11 @@ True >>> qs[:1] [<User: fred>] +# Regression test for #8039: Ordering sometimes removed relevant tables from +# extra(). This test is the critical case: ordering uses a table, but then +# removes the reference because of an optimisation. The table should still be +# present because of the extra() call. +>>> Order.objects.extra(where=["username=%s"], params=["fred"], tables=["auth_user"]).order_by('created_by') +[] + """} |
