summaryrefslogtreecommitdiff
path: root/test/sql/test_constraints.py
diff options
context:
space:
mode:
authordonkopotamus <derek.harland@finq.co.nz>2014-01-17 11:00:24 +1300
committerdonkopotamus <derek.harland@finq.co.nz>2014-01-17 11:00:24 +1300
commitcf8e5e3cf5b0e1be05a611c8828690acfcd2b9fa (patch)
tree987e7b4f0ff40a686d600549d03b43e34d6aa9ac /test/sql/test_constraints.py
parent35935489608c6a896790ed0c51c3ea4b4eb6186f (diff)
downloadsqlalchemy-cf8e5e3cf5b0e1be05a611c8828690acfcd2b9fa.tar.gz
Bug Fix: Stop generating bad sql if an empty UniqueConstraint() is given
Diffstat (limited to 'test/sql/test_constraints.py')
-rw-r--r--test/sql/test_constraints.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/sql/test_constraints.py b/test/sql/test_constraints.py
index 393bcd448..cb4b73ec8 100644
--- a/test/sql/test_constraints.py
+++ b/test/sql/test_constraints.py
@@ -544,6 +544,28 @@ class ConstraintCompilationTest(fixtures.TestBase, AssertsCompiledSQL):
"FOREIGN KEY(foo_bar) REFERENCES foo (bar))"
)
+ def test_empty_pkc(self):
+ # test that an empty primary key is ignored
+ metadata = MetaData()
+ tbl = Table('test', metadata,
+ Column('x', Integer, autoincrement=False),
+ Column('y', Integer, autoincrement=False),
+ PrimaryKeyConstraint())
+ self.assert_compile(schema.CreateTable(tbl),
+ "CREATE TABLE test (x INTEGER, y INTEGER)"
+ )
+
+ def test_empty_uc(self):
+ # test that an empty constraint is ignored
+ metadata = MetaData()
+ tbl = Table('test', metadata,
+ Column('x', Integer, autoincrement=False),
+ Column('y', Integer, autoincrement=False),
+ UniqueConstraint())
+ self.assert_compile(schema.CreateTable(tbl),
+ "CREATE TABLE test (x INTEGER, y INTEGER)"
+ )
+
def test_deferrable_column_check(self):
t = Table('tbl', MetaData(),
Column('a', Integer),