diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-12-06 19:51:10 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-12-06 19:51:10 +0000 |
commit | f9cb6f5834fb1acf4460fd9bb6b72f8c76f8c36c (patch) | |
tree | d2ec1ec2f53858f927db3059cc0cf9ba6a8034d5 /test/dialect/test_postgresql.py | |
parent | 4ca12d76bd8580d56c4ec1f7ed95c0e37a4c281a (diff) | |
download | sqlalchemy-f9cb6f5834fb1acf4460fd9bb6b72f8c76f8c36c.tar.gz |
- reworked the DDL generation of ENUM and similar to be more platform agnostic.
Uses a straight CheckConstraint with a generic expression. Preparing for boolean
constraint in [ticket:1589]
- CheckConstraint now accepts SQL expressions, though support for quoting of values
will be very limited. we don't want to get into formatting dates and such.
Diffstat (limited to 'test/dialect/test_postgresql.py')
-rw-r--r-- | test/dialect/test_postgresql.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/test/dialect/test_postgresql.py b/test/dialect/test_postgresql.py index 39771bbe9..c929d38b3 100644 --- a/test/dialect/test_postgresql.py +++ b/test/dialect/test_postgresql.py @@ -84,19 +84,20 @@ class CompileTest(TestBase, AssertsCompiledSQL): self.assert_compile(i, "INSERT INTO mytable (name) VALUES (%(name)s) RETURNING mytable.myid, mytable.name", dialect=dialect) def test_create_partial_index(self): - tbl = Table('testtbl', MetaData(), Column('data',Integer)) + m = MetaData() + tbl = Table('testtbl', m, Column('data',Integer)) idx = Index('test_idx1', tbl.c.data, postgresql_where=and_(tbl.c.data > 5, tbl.c.data < 10)) self.assert_compile(schema.CreateIndex(idx), - "CREATE INDEX test_idx1 ON testtbl (data) WHERE testtbl.data > 5 AND testtbl.data < 10", dialect=postgresql.dialect()) - + "CREATE INDEX test_idx1 ON testtbl (data) WHERE data > 5 AND data < 10", dialect=postgresql.dialect()) + @testing.uses_deprecated(r".*'postgres_where' argument has been renamed.*") def test_old_create_partial_index(self): tbl = Table('testtbl', MetaData(), Column('data',Integer)) idx = Index('test_idx1', tbl.c.data, postgres_where=and_(tbl.c.data > 5, tbl.c.data < 10)) self.assert_compile(schema.CreateIndex(idx), - "CREATE INDEX test_idx1 ON testtbl (data) WHERE testtbl.data > 5 AND testtbl.data < 10", dialect=postgresql.dialect()) + "CREATE INDEX test_idx1 ON testtbl (data) WHERE data > 5 AND data < 10", dialect=postgresql.dialect()) def test_extract(self): t = table('t', column('col1')) @@ -214,7 +215,7 @@ class EnumTest(TestBase, AssertsExecutionResults, AssertsCompiledSQL): schema.CreateTable(t1), "CREATE TABLE sometable (" "somecolumn VARCHAR(1), " - " CHECK (somecolumn IN ('x','y','z'))" + "CHECK (somecolumn IN ('x', 'y', 'z'))" ")" ) |