summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-10-24 06:09:47 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-10-24 06:09:47 +0000
commit9319dc496c5f8d215a293fff5fb974e48e68454d (patch)
treeb3cc670ec3aaf79ff709001349a16c055f149a21 /tests
parente3aa9a28288737a75f05f2174b4105d01e52af96 (diff)
Fixed #9406 -- Ensure that each database column is only represented once in the
"ORDER BY" clause of an SQL statement. git-svn-id: http://code.djangoproject.com/svn/django/trunk@9251 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/model_inheritance_regress/models.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/regressiontests/model_inheritance_regress/models.py b/tests/regressiontests/model_inheritance_regress/models.py
index 2777d1f23a..06a886e0be 100644
--- a/tests/regressiontests/model_inheritance_regress/models.py
+++ b/tests/regressiontests/model_inheritance_regress/models.py
@@ -257,4 +257,14 @@ DoesNotExist: ArticleWithAuthor matching query does not exist.
# without error.
>>> _ = QualityControl.objects.create(headline="Problems in Django", pub_date=datetime.datetime.now(), quality=10, assignee="adrian")
+# Ordering should not include any database column more than once (this is most
+# likely to ocurr naturally with model inheritance, so we check it here).
+# Regression test for #9390. This necessarily pokes at the SQL string for the
+# query, since the duplicate problems are only apparent at that late stage.
+>>> sql = ArticleWithAuthor.objects.order_by('pub_date', 'pk').query.as_sql()[0]
+>>> fragment = sql[sql.find('ORDER BY'):]
+>>> pos = fragment.find('pub_date')
+>>> fragment.find('pub_date', pos + 1) == -1
+True
+
"""}