summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-04-23 13:07:50 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-04-23 13:07:50 -0400
commit7c8f977fc5e6c7e4ed329d217710c56aa0e18d70 (patch)
treeece5afbcc1f34401c4bcae535d079d760775af5e /lib/sqlalchemy
parentb6f04d928853df8cb575fba9ba87c07c66564cd6 (diff)
parent177ad548c458a9f1b8d43378fa8f16e349f80ac3 (diff)
downloadsqlalchemy-7c8f977fc5e6c7e4ed329d217710c56aa0e18d70.tar.gz
merge default
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/psycopg2.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/psycopg2.py b/lib/sqlalchemy/dialects/postgresql/psycopg2.py
index f5e122a1b..805fc72af 100644
--- a/lib/sqlalchemy/dialects/postgresql/psycopg2.py
+++ b/lib/sqlalchemy/dialects/postgresql/psycopg2.py
@@ -422,7 +422,7 @@ class PGDialect_psycopg2(PGDialect):
def is_disconnect(self, e, connection, cursor):
if isinstance(e, self.dbapi.Error):
- str_e = str(e)
+ str_e = str(e).partition("\n")[0]
for msg in [
# these error messages from libpq: interfaces/libpq/fe-misc.c
# and interfaces/libpq/fe-secure.c.
@@ -439,7 +439,8 @@ class PGDialect_psycopg2(PGDialect):
# be obsolete. It really says "losed", not "closed".
'losed the connection unexpectedly'
]:
- if msg in str_e:
+ idx = str_e.find(msg)
+ if idx >= 0 and '"' not in str_e[:idx]:
return True
return False