diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-10-12 20:04:55 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-10-12 20:13:27 -0400 |
| commit | d8c17e2a6f41d0aad331678e916f1aa4f07e4f7b (patch) | |
| tree | a8390553ad61d5da567dd5f03515b614da2f88b7 /lib/sqlalchemy/dialects/postgresql/base.py | |
| parent | e488bb47e4bd21ff0a09ce23e1adf00ba64d5d57 (diff) | |
| download | sqlalchemy-d8c17e2a6f41d0aad331678e916f1aa4f07e4f7b.tar.gz | |
- Fixed bug in default compiler plus those of postgresql, mysql, and
mssql to ensure that any literal SQL expression values are
rendered directly as literals, instead of as bound parameters,
within a CREATE INDEX statement. [ticket:2742]
- don't need expression_as_ddl(); literal_binds and include_table
take care of this functionality.
Conflicts:
lib/sqlalchemy/sql/util.py
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/base.py')
| -rw-r--r-- | lib/sqlalchemy/dialects/postgresql/base.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index 1c8a71fbd..2cbe7c830 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -1101,12 +1101,9 @@ class PGDDLCompiler(compiler.DDLCompiler): text += "(%s)" \ % ( ', '.join([ - self.sql_compiler.process(expr, include_table=False) + - - + self.sql_compiler.process( + 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)]) ) @@ -1116,8 +1113,9 @@ class PGDDLCompiler(compiler.DDLCompiler): whereclause = None if whereclause is not None: - whereclause = sql_util.expression_as_ddl(whereclause) - where_compiled = self.sql_compiler.process(whereclause) + where_compiled = self.sql_compiler.process( + whereclause, include_table=False, + literal_binds=True) text += " WHERE " + where_compiled return text @@ -1132,8 +1130,9 @@ class PGDDLCompiler(compiler.DDLCompiler): elements.append(self.preparer.quote(c.name, c.quote)+' WITH '+op) text += "EXCLUDE USING %s (%s)" % (constraint.using, ', '.join(elements)) if constraint.where is not None: - sqltext = sql_util.expression_as_ddl(constraint.where) - text += ' WHERE (%s)' % self.sql_compiler.process(sqltext) + text += ' WHERE (%s)' % self.sql_compiler.process( + constraint.where, + literal_binds=True) text += self.define_constraint_deferrability(constraint) return text |
