From: Mike Bayer Date: Tue, 26 Mar 2019 17:29:57 +0000 (-0400) Subject: Test double colons without escaping in text() X-Git-Tag: rel_1_3_2~3^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8fca639c914e79b1bffe6f6546b49f474255701;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Test double colons without escaping in text() Apparently the BIND_PARAMS regex passes over double colons, it just doesn't accommodate for a bound parameter in that case. add this use case to current tests as people can be relying upon it. Change-Id: I6555621b1bb05d09b17428f4b4094ff7b219b460 --- diff --git a/test/sql/test_text.py b/test/sql/test_text.py index bcaf905fe6..188ac3878c 100644 --- a/test/sql/test_text.py +++ b/test/sql/test_text.py @@ -331,6 +331,19 @@ class BindParamTest(fixtures.TestBase, AssertsCompiledSQL): dialect="postgresql", ) + def test_double_colons_dont_actually_need_escaping(self): + # this is news to me. bound param won't work but you can put the + # double colons in + self.assert_compile( + text( + r"SELECT * FROM pg_attribute WHERE " + r"attrelid = foo::regclass" + ), + "SELECT * FROM pg_attribute WHERE " "attrelid = foo::regclass", + params={}, + dialect="postgresql", + ) + def test_text_in_select_nonfrom(self): generate_series = text(