Index: django/db/backends/postgresql_psycopg2/base.py
===================================================================
--- django/db/backends/postgresql_psycopg2/base.py	(revision 16883)
+++ django/db/backends/postgresql_psycopg2/base.py	(working copy)
@@ -146,6 +146,18 @@
         new_connection = False
         set_tz = False
         settings_dict = self.settings_dict
+        if self.connection is not None:
+            try:
+                cursor = self.connection.cursor()
+            except Database.Error:
+                # It seems we lost our connection without getting a notification.
+                # Make sure the connection is really closed and connection is set
+                # to None. The code below will then create a new connection. See
+                # also the above comment in close().
+                try:
+                    self.close()
+                except Database.Error:
+                    pass
         if self.connection is None:
             new_connection = True
             set_tz = settings_dict.get('TIME_ZONE')
@@ -170,7 +182,7 @@
             self.connection.set_client_encoding('UTF8')
             self.connection.set_isolation_level(self.isolation_level)
             connection_created.send(sender=self.__class__, connection=self)
-        cursor = self.connection.cursor()
+            cursor = self.connection.cursor()
         cursor.tzinfo_factory = None
         if new_connection:
             if set_tz:
