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:04:55 -0400 |
commit | 9bc9d5c1068be878118202259add3c2e1bcec0cb (patch) | |
tree | 9e611c162b83debad6c70b5436c61630546c2872 /lib/sqlalchemy/sql/compiler.py | |
parent | eabf41b392ac042228765c9b95138522e44365e7 (diff) | |
download | sqlalchemy-9bc9d5c1068be878118202259add3c2e1bcec0cb.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.
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index f81886240..9f2abd6f5 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -2305,7 +2305,7 @@ class DDLCompiler(Compiled): use_schema=include_table_schema), ', '.join( self.sql_compiler.process(expr, - include_table=False) for + include_table=False, literal_binds=True) for expr in index.expressions) ) return text @@ -2392,8 +2392,9 @@ class DDLCompiler(Compiled): if constraint.name is not None: text += "CONSTRAINT %s " % \ self.preparer.format_constraint(constraint) - sqltext = sql_util.expression_as_ddl(constraint.sqltext) - text += "CHECK (%s)" % self.sql_compiler.process(sqltext) + text += "CHECK (%s)" % self.sql_compiler.process(constraint.sqltext, + include_table=False, + literal_binds=True) text += self.define_constraint_deferrability(constraint) return text |