From: Mike Bayer Date: Tue, 9 Feb 2016 23:05:40 +0000 (-0500) Subject: - Fixed bug in :func:`.expression.text` construct where a double-colon X-Git-Tag: rel_1_1_0b1~98^2~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=29dcaa2b0ae2d26b36ec624be80f56e03ab9095e;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - Fixed bug in :func:`.expression.text` construct where a double-colon expression would not escape properly, e.g. ``some\:\:expr``, as is most commonly required when rendering Postgresql-style CAST expressions. fixes #3644 --- diff --git a/doc/build/changelog/changelog_10.rst b/doc/build/changelog/changelog_10.rst index 6130fdcefc..d607110aae 100644 --- a/doc/build/changelog/changelog_10.rst +++ b/doc/build/changelog/changelog_10.rst @@ -19,6 +19,14 @@ :version: 1.0.12 :released: + .. change:: + :tags: bug, postgresql + :tickets: 3644 + + Fixed bug in :func:`.expression.text` construct where a double-colon + expression would not escape properly, e.g. ``some\:\:expr``, as is most + commonly required when rendering Postgresql-style CAST expressions. + .. change:: :tags: bug, sql :tickets: 3643 diff --git a/test/sql/test_text.py b/test/sql/test_text.py index 78c3282ac7..20cb2a6fbd 100644 --- a/test/sql/test_text.py +++ b/test/sql/test_text.py @@ -281,6 +281,17 @@ class BindParamTest(fixtures.TestBase, AssertsCompiledSQL): dialect="postgresql" ) + def test_escaping_double_colons(self): + self.assert_compile( + text( + "SELECT * FROM pg_attribute WHERE " + "attrelid = :tab\:\:regclass"), + "SELECT * FROM pg_attribute WHERE " + "attrelid = %(tab)s::regclass", + params={'tab': None}, + dialect="postgresql" + ) + def test_text_in_select_nonfrom(self): generate_series = text("generate_series(:x, :y, :z) as s(a)").\