Code

Ticket #5063: psycopg2.patch

File psycopg2.patch, 713 bytes (added by Adriano, 6 years ago)

Updated version for Django trunk. Note: This requires testing in production

  • django/db/backends/postgresql_psycopg2/base.py

     
    5252 
    5353    def _cursor(self, settings): 
    5454        set_tz = False 
     55 
     56        # ISSUE: OperationalError causes the connection to close without properly setting self.connection 
     57        # BEGIN: Correction 
     58        if self.connection and self.connection.closed: 
     59            self.connection = None 
     60        #   END: Correction 
     61         
    5562        if self.connection is None: 
    5663            set_tz = True 
    5764            if settings.DATABASE_NAME == '':