summaryrefslogtreecommitdiff
path: root/test/dialect/test_postgresql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-03-09 17:40:06 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2013-03-09 17:40:06 -0500
commita0de45185bf510fca9e237d9191e89391d118591 (patch)
tree889eb10d656581848ae3bc978b44d90634348808 /test/dialect/test_postgresql.py
parentc8a80e21301791fd4e1caf29ed8cadd40f617765 (diff)
downloadsqlalchemy-a0de45185bf510fca9e237d9191e89391d118591.tar.gz
Added support for Postgresql's traditional SUBSTRING
function syntax, renders as "SUBSTRING(x FROM y FOR z)" when regular ``func.substring()`` is used. Also in 0.7.11. Courtesy Gunnlaugur Por Briem. [ticket:2676]
Diffstat (limited to 'test/dialect/test_postgresql.py')
-rw-r--r--test/dialect/test_postgresql.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/dialect/test_postgresql.py b/test/dialect/test_postgresql.py
index d9fb9830d..62e855356 100644
--- a/test/dialect/test_postgresql.py
+++ b/test/dialect/test_postgresql.py
@@ -180,6 +180,14 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
'USING hash (data)',
dialect=postgresql.dialect())
+ def test_substring(self):
+ self.assert_compile(func.substring('abc', 1, 2),
+ 'SUBSTRING(%(substring_1)s FROM %(substring_2)s '
+ 'FOR %(substring_3)s)')
+ self.assert_compile(func.substring('abc', 1),
+ 'SUBSTRING(%(substring_1)s FROM %(substring_2)s)')
+
+
def test_extract(self):
t = table('t', column('col1', DateTime), column('col2', Date),