From 9319dc496c5f8d215a293fff5fb974e48e68454d Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Fri, 24 Oct 2008 06:09:47 +0000 Subject: 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 --- tests/regressiontests/model_inheritance_regress/models.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') 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 + """} -- cgit v1.3