summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/compiler.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-08-18 14:46:04 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-08-18 14:46:04 -0400
commit236db85f96e84fe099e63182bc4e67ceb65bd0d0 (patch)
treeeeab827ef786b6130f0b2d4d509b78d50cb96a71 /lib/sqlalchemy/sql/compiler.py
parente7c179ac72abf83d32da6a79e5c94f58aa28f904 (diff)
downloadsqlalchemy-236db85f96e84fe099e63182bc4e67ceb65bd0d0.tar.gz
Fixed regression dating back to 0.7.9 whereby the name of a CTE might
not be properly quoted if it was referred to in multiple FROM clauses. Also in 0.8.3, 0.7.11. [ticket:2801]
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r--lib/sqlalchemy/sql/compiler.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index a6e6987c5..dc3d55039 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -1049,7 +1049,7 @@ class SQLCompiler(Compiled):
# we've generated a same-named CTE that we are enclosed in,
# or this is the same CTE. just return the name.
if cte in existing_cte._restates or cte is existing_cte:
- return cte_name
+ return self.preparer.format_alias(cte, cte_name)
elif existing_cte in cte._restates:
# we've generated a same-named CTE that is
# enclosed in us - we take precedence, so