diff options
author | Jason Kirtland <jek@discorporate.us> | 2009-03-30 20:41:48 +0000 |
---|---|---|
committer | Jason Kirtland <jek@discorporate.us> | 2009-03-30 20:41:48 +0000 |
commit | aca84bebb091a51ceeb911249c366e17b954826a (patch) | |
tree | 87a0424805905c9fdae0ab6930144c91b9a78ff6 /test/dialect/postgres.py | |
parent | 1ad157a0a1823706ffb43ee7d235c38ae16f46ff (diff) | |
download | sqlalchemy-aca84bebb091a51ceeb911249c366e17b954826a.tar.gz |
extract() is now dialect-sensitive and supports SQLite and others.
Diffstat (limited to 'test/dialect/postgres.py')
-rw-r--r-- | test/dialect/postgres.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/dialect/postgres.py b/test/dialect/postgres.py index 3867d1b01..d613ad2dd 100644 --- a/test/dialect/postgres.py +++ b/test/dialect/postgres.py @@ -22,6 +22,8 @@ class SequenceTest(TestBase, AssertsCompiledSQL): assert dialect.identifier_preparer.format_sequence(seq) == '"Some_Schema"."My_Seq"' class CompileTest(TestBase, AssertsCompiledSQL): + __dialect__ = postgres.dialect() + def test_update_returning(self): dialect = postgres.dialect() table1 = table('mytable', @@ -58,6 +60,16 @@ class CompileTest(TestBase, AssertsCompiledSQL): i = insert(table1, values=dict(name='foo'), postgres_returning=[func.length(table1.c.name)]) self.assert_compile(i, "INSERT INTO mytable (name) VALUES (%(name)s) RETURNING length(mytable.name)", dialect=dialect) + def test_extract(self): + t = table('t', column('col1')) + + for field in 'year', 'month', 'day': + self.assert_compile( + select([extract(field, t.c.col1)]), + "SELECT EXTRACT(%s FROM t.col1::timestamp) AS anon_1 " + "FROM t" % field) + + class ReturningTest(TestBase, AssertsExecutionResults): __only_on__ = 'postgres' |