summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-10-12 20:21:18 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-10-12 20:21:38 -0400
commit70fdd3efa7a9a9a0fcf6cebf0853c44f04cf9a04 (patch)
treeedaa5a4a8cc83e74e0e314c917e93599a2513d8f /lib/sqlalchemy/dialects/postgresql
parentd8c17e2a6f41d0aad331678e916f1aa4f07e4f7b (diff)
downloadsqlalchemy-70fdd3efa7a9a9a0fcf6cebf0853c44f04cf9a04.tar.gz
Parenthesis will be applied to a compound SQL expression as
rendered in the column list of a CREATE INDEX statement. [ticket:2742]
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/base.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py
index 2cbe7c830..b879fb742 100644
--- a/lib/sqlalchemy/dialects/postgresql/base.py
+++ b/lib/sqlalchemy/dialects/postgresql/base.py
@@ -1102,7 +1102,10 @@ class PGDDLCompiler(compiler.DDLCompiler):
% (
', '.join([
self.sql_compiler.process(
- expr, include_table=False, literal_binds=True) +
+ expr.self_group()
+ if not isinstance(expr, expression.ColumnClause)
+ else expr,
+ include_table=False, literal_binds=True) +
(c.key in ops and (' ' + ops[c.key]) or '')
for expr, c in zip(index.expressions, index.columns)])
)