diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-01-16 18:03:45 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-01-16 18:03:45 -0500 |
commit | 79fa69f1f37fdbc0dfec6bdea1e07f52bfe18f7b (patch) | |
tree | 02fba7faed7318101abc98c17ce3fdc50ea8110e /lib/sqlalchemy/dialects/postgresql/base.py | |
parent | 41307cd7339a2a2aee0a3dd9c8b994df99d7eedb (diff) | |
download | sqlalchemy-79fa69f1f37fdbc0dfec6bdea1e07f52bfe18f7b.tar.gz |
- Fixed bug where Postgresql dialect would fail to render an
expression in an :class:`.Index` that did not correspond directly
to a table-bound column; typically when a :func:`.text` construct
was one of the expressions within the index; or could misinterpret the
list of expressions if one or more of them were such an expression.
fixes #3174
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/base.py')
-rw-r--r-- | lib/sqlalchemy/dialects/postgresql/base.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index fa9a2cfd0..0817fe837 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -1477,8 +1477,13 @@ class PGDDLCompiler(compiler.DDLCompiler): 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)]) + ( + (' ' + ops[expr.key]) + if hasattr(expr, 'key') + and expr.key in ops else '' + ) + for expr in index.expressions + ]) ) whereclause = index.dialect_options["postgresql"]["where"] |