summaryrefslogtreecommitdiff
path: root/test/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-10-12 20:04:55 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-10-12 20:04:55 -0400
commit9bc9d5c1068be878118202259add3c2e1bcec0cb (patch)
tree9e611c162b83debad6c70b5436c61630546c2872 /test/sql
parenteabf41b392ac042228765c9b95138522e44365e7 (diff)
downloadsqlalchemy-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 'test/sql')
-rw-r--r--test/sql/test_constraints.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/sql/test_constraints.py b/test/sql/test_constraints.py
index b44a65190..393bcd448 100644
--- a/test/sql/test_constraints.py
+++ b/test/sql/test_constraints.py
@@ -726,6 +726,27 @@ class ConstraintCompilationTest(fixtures.TestBase, AssertsCompiledSQL):
"ALTER TABLE tbl ADD PRIMARY KEY (a)"
)
+ def test_render_check_constraint_sql_literal(self):
+ t, t2 = self._constraint_create_fixture()
+
+ constraint = CheckConstraint(t.c.a > 5)
+
+ self.assert_compile(
+ schema.AddConstraint(constraint),
+ "ALTER TABLE tbl ADD CHECK (a > 5)"
+ )
+
+ def test_render_index_sql_literal(self):
+ t, t2 = self._constraint_create_fixture()
+
+ constraint = Index('name', t.c.a + 5)
+
+ self.assert_compile(
+ schema.CreateIndex(constraint),
+ "CREATE INDEX name ON tbl (a + 5)"
+ )
+
+
class ConstraintAPITest(fixtures.TestBase):
def test_double_fk_usage_raises(self):
f = ForeignKey('b.id')