summaryrefslogtreecommitdiff
path: root/test/dialect/test_postgresql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2009-12-29 16:19:09 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2009-12-29 16:19:09 +0000
commitebb54d1bc249306a08067cefce93d1676fdb14ba (patch)
tree5038045c5021224b9e7532f7b3c9aa4d12342b4c /test/dialect/test_postgresql.py
parent67481f534f073015e7fd003111cc1e04028a16c2 (diff)
downloadsqlalchemy-ebb54d1bc249306a08067cefce93d1676fdb14ba.tar.gz
merge r6591, r6592 from 0.5 branch for PGInterval etc. /extract
Diffstat (limited to 'test/dialect/test_postgresql.py')
-rw-r--r--test/dialect/test_postgresql.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/test/dialect/test_postgresql.py b/test/dialect/test_postgresql.py
index 7cf22a3ed..fdc2e7ea9 100644
--- a/test/dialect/test_postgresql.py
+++ b/test/dialect/test_postgresql.py
@@ -100,8 +100,9 @@ class CompileTest(TestBase, AssertsCompiledSQL):
"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', DateTime), column('col2', Date), column('col3', Time))
+ t = table('t', column('col1', DateTime), column('col2', Date), column('col3', Time),
+ column('col4', postgresql.INTERVAL)
+ )
for field in 'year', 'month', 'day', 'epoch', 'hour':
for expr, compiled_expr in [
@@ -130,6 +131,9 @@ class CompileTest(TestBase, AssertsCompiledSQL):
(datetime.timedelta(days=5) + t.c.col2,
"(%(col2_1)s + t.col2) :: timestamp"
),
+ (t.c.col1 + t.c.col4,
+ "(t.col1 + t.col4) :: timestamp"
+ ),
# subtraction is not
(t.c.col1 - datetime.timedelta(seconds=30),
"(t.col1 - %(col1_1)s) :: timestamp"
@@ -152,6 +156,9 @@ class CompileTest(TestBase, AssertsCompiledSQL):
(literal(datetime.timedelta(seconds=10)) - literal(datetime.timedelta(seconds=10)),
"(%(param_1)s - %(param_2)s) :: interval"
),
+ (t.c.col3 + "some string", # dont crack up on entirely unsupported types
+ "t.col3 + %(col3_1)s"
+ )
]:
self.assert_compile(
select([extract(field, expr)]).select_from(t),