summaryrefslogtreecommitdiff
path: root/test/dialect/postgresql/test_compiler.py
diff options
context:
space:
mode:
authoraisch <me+bosch@aitmp.com>2015-11-23 10:22:50 -0800
committeraisch <me+bosch@aitmp.com>2015-11-23 10:22:50 -0800
commit0921a6abbc8246c57f447af7a6ac240778127fae (patch)
treefbc25b9774f01f177342dec52aeeb1fa643b2cc6 /test/dialect/postgresql/test_compiler.py
parentf7943db2f32e3cace9cadc5cf05402d425b76d33 (diff)
downloadsqlalchemy-pr/215.tar.gz
fix postgresql exclude contraint to check when= against None rather than __bool__ evalpr/215
Diffstat (limited to 'test/dialect/postgresql/test_compiler.py')
-rw-r--r--test/dialect/postgresql/test_compiler.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/dialect/postgresql/test_compiler.py b/test/dialect/postgresql/test_compiler.py
index 78217bd82..13acf8c86 100644
--- a/test/dialect/postgresql/test_compiler.py
+++ b/test/dialect/postgresql/test_compiler.py
@@ -510,6 +510,19 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
'(CAST("Room" AS TEXT) WITH =)'
)
+ def test_exclude_constraint_when(self):
+ m = MetaData()
+ tbl = Table(
+ 'testtbl', m,
+ Column('room', String)
+ )
+ cons = ExcludeConstraint(('room', '='), where=tbl.c.room.in_(['12']))
+ tbl.append_constraint(cons)
+ self.assert_compile(schema.AddConstraint(cons),
+ 'ALTER TABLE testtbl ADD EXCLUDE USING gist '
+ '(room WITH =) WHERE (testtbl.room IN (\'12\'))',
+ dialect=postgresql.dialect())
+
def test_substring(self):
self.assert_compile(func.substring('abc', 1, 2),
'SUBSTRING(%(substring_1)s FROM %(substring_2)s '