summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/elements.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-10-05 23:47:49 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-10-05 23:47:49 -0400
commitd79e1d69a6b2d0d1cc18d3d9d0283ef4a77925bc (patch)
tree0920ce1c66894cdf5a2ba60c1f53e79fddb90a75 /lib/sqlalchemy/sql/elements.py
parentaba78471867d1ae2cfbbf358482b2a9b771cc6b0 (diff)
downloadsqlalchemy-d79e1d69a6b2d0d1cc18d3d9d0283ef4a77925bc.tar.gz
- fix propagation of quote flag within _gen_label() so that if the
name is already an instance of _anonymous_label(), we don't downgrade it to a plain quoted_name - fixes regression from [ticket:2812]. [ticket:2834]
Diffstat (limited to 'lib/sqlalchemy/sql/elements.py')
-rw-r--r--lib/sqlalchemy/sql/elements.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py
index ea2132e67..73a8a0b82 100644
--- a/lib/sqlalchemy/sql/elements.py
+++ b/lib/sqlalchemy/sql/elements.py
@@ -2018,6 +2018,7 @@ class ColumnClause(Immutable, ColumnElement):
def _gen_label(self, name):
t = self.table
+
if self.is_literal:
return None
@@ -2030,8 +2031,14 @@ class ColumnClause(Immutable, ColumnElement):
# propagate name quoting rules for labels.
if getattr(name, "quote", None) is not None:
- label = quoted_name(label, name.quote)
+ if isinstance(label, quoted_name):
+ label.quote = name.quote
+ else:
+ label = quoted_name(label, name.quote)
elif getattr(t.name, "quote", None) is not None:
+ # can't get this situation to occur, so let's
+ # assert false on it for now
+ assert not isinstance(label, quoted_name)
label = quoted_name(label, t.name.quote)
# ensure the label name doesn't conflict with that