summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-02-14 14:39:41 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2014-02-14 14:39:41 -0500
commit28229a35e0231e770679ce48436f7e31723ac159 (patch)
treedc4ab4ab6574c1099e64a57b29560aac038beaec
parent5330c02b729782c2774bc4b956ccd2b4ca134eb4 (diff)
downloadsqlalchemy-28229a35e0231e770679ce48436f7e31723ac159.tar.gz
- 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
-rw-r--r--doc/build/changelog/changelog_09.rst9
-rw-r--r--lib/sqlalchemy/dialects/postgresql/base.py3
2 files changed, 11 insertions, 1 deletions
diff --git a/doc/build/changelog/changelog_09.rst b/doc/build/changelog/changelog_09.rst
index b57ebdc92..db1079d8a 100644
--- a/doc/build/changelog/changelog_09.rst
+++ b/doc/build/changelog/changelog_09.rst
@@ -15,6 +15,15 @@
: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 1b5927dbd..4cd462a72 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'