summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-09-22 00:31:22 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-09-22 00:31:22 +0000
commit922aba3def68e57c405a0e50d353a790af85b00a (patch)
treee1710bd187b39abc2c555748f55317d8a4b42018
parentfd366a85315dfc836e73f9cdee3e7309281dfd3e (diff)
Fixed a missing variable initialisation deep in the Query bowels.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9081 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/db/models/sql/query.py1
-rw-r--r--tests/regressiontests/queries/models.py5
2 files changed, 6 insertions, 0 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index b4525f1075..bf3b63f100 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -808,6 +808,7 @@ class Query(object):
self.where.relabel_aliases(change_map)
for pos, col in enumerate(self.select):
if isinstance(col, (list, tuple)):
+ old_alias = col[0]
self.select[pos] = (change_map.get(old_alias, old_alias), col[1])
else:
col.relabel_aliases(change_map)
diff --git a/tests/regressiontests/queries/models.py b/tests/regressiontests/queries/models.py
index 49b45e83fd..2f027f8d36 100644
--- a/tests/regressiontests/queries/models.py
+++ b/tests/regressiontests/queries/models.py
@@ -966,6 +966,11 @@ about them and shouldn't do bad things.
>>> expected == result
True
+Make sure bump_prefix() (an internal Query method) doesn't (re-)break.
+>>> query = Tag.objects.values_list('id').order_by().query
+>>> query.bump_prefix()
+>>> print query.as_sql()[0]
+SELECT U0."id" FROM "queries_tag" U0
"""}
# In Python 2.3 and the Python 2.6 beta releases, exceptions raised in __len__