From: Mike Bayer Date: Fri, 14 Feb 2014 19:39:41 +0000 (-0500) Subject: - Added server version detection to the newly added dialect startup X-Git-Tag: rel_0_9_3~36 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=28229a35e0231e770679ce48436f7e31723ac159;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - Added server version detection to the newly added dialect startup query for "show standard_conforming_strings"; as this variable was added as of PG 8.2, we skip the query for PG versions older than that as well as for backends like Redshift. #2946 --- diff --git a/doc/build/changelog/changelog_09.rst b/doc/build/changelog/changelog_09.rst index b57ebdc92b..db1079d8a6 100644 --- a/doc/build/changelog/changelog_09.rst +++ b/doc/build/changelog/changelog_09.rst @@ -14,6 +14,15 @@ .. changelog:: :version: 0.9.3 + .. change:: + :tags: bug, postgresql + :tickets: 2946 + + Added server version detection to the newly added dialect startup + query for "show standard_conforming_strings"; as this variable was + added as of PG 8.2, we skip the query for PG versions older than + that as well as for backends like Redshift. + .. change:: :tags: bug, orm, declarative :tickets: 2950 diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index 1b5927dbd1..4cd462a727 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -1567,7 +1567,8 @@ class PGDialect(default.DefaultDialect): # http://www.postgresql.org/docs/9.3/static/release-9-2.html#AEN116689 self.supports_smallserial = self.server_version_info >= (9, 2) - self._backslash_escapes = connection.scalar( + self._backslash_escapes = self.server_version_info < (8, 2) or \ + connection.scalar( "show standard_conforming_strings" ) == 'off'