diff options
Diffstat (limited to 'test/dialect/postgresql/test_compiler.py')
-rw-r--r-- | test/dialect/postgresql/test_compiler.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/dialect/postgresql/test_compiler.py b/test/dialect/postgresql/test_compiler.py index 99706bad8..160641855 100644 --- a/test/dialect/postgresql/test_compiler.py +++ b/test/dialect/postgresql/test_compiler.py @@ -555,6 +555,30 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): 'ALTER TABLE testtbl ADD EXCLUDE USING gist ' '(room WITH =)') + def test_exclude_constraint_copy_where_using(self): + m = MetaData() + tbl = Table('testtbl', m, + Column('room', Integer, primary_key=True), + ) + cons = ExcludeConstraint( + (tbl.c.room, '='), where=tbl.c.room > 5, using='foobar') + tbl.append_constraint(cons) + self.assert_compile( + schema.AddConstraint(cons), + "ALTER TABLE testtbl ADD EXCLUDE USING foobar " + "(room WITH =) WHERE (testtbl.room > 5)" + ) + + m2 = MetaData() + tbl2 = tbl.tometadata(m2) + self.assert_compile( + schema.CreateTable(tbl2), + "CREATE TABLE testtbl (room SERIAL NOT NULL, " + "PRIMARY KEY (room), " + "EXCLUDE USING foobar " + "(room WITH =) WHERE (testtbl.room > 5))" + ) + def test_exclude_constraint_text(self): m = MetaData() cons = ExcludeConstraint((text('room::TEXT'), '=')) |