Commits

Mike Bayer  committed ffdba3e

- [bug] Added 'terminating connection' to the list
of messages we use to detect a disconnect with PG, which
appears to be present in some versions when the server
is restarted. [ticket:2570]

  • Participants
  • Parent commits 1329ad3

Comments (0)

Files changed (2)

     orders them.  Courtesy Gunnlaugur Þór Briem.
     [ticket:2531].
 
+  - [bug] Added 'terminating connection' to the list
+    of messages we use to detect a disconnect with PG, which
+    appears to be present in some versions when the server
+    is restarted.  [ticket:2570]
+
 - mysql
   - [bug] Updated mysqlconnector interface to use
     updated "client flag" and "charset" APIs,

File lib/sqlalchemy/dialects/postgresql/psycopg2.py

             # these error messages from libpq: interfaces/libpq/fe-misc.c.
             # TODO: these are sent through gettext in libpq and we can't
             # check within other locales - consider using connection.closed
-            return 'closed the connection' in str(e) or \
+            return 'terminating connection' in str(e) or \
+                    'closed the connection' in str(e) or \
                     'connection not open' in str(e) or \
                     'could not receive data from server' in str(e)
         elif isinstance(e, self.dbapi.InterfaceError):