Ticket #3460: combined.diff

File combined.diff, 1.5 KB (added by Jack Moffitt <metajack@…>, 8 years ago)

updated patch; also fixes #3459

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

     
    2828
    2929    def cursor(self):
    3030        from django.conf import settings
     31        first_cursor = False
    3132        if self.connection is None:
     33            first_cursor = True
    3234            if settings.DATABASE_NAME == '':
    3335                from django.core.exceptions import ImproperlyConfigured
    3436                raise ImproperlyConfigured, "You need to specify DATABASE_NAME in your Django settings file."
     
    4244            if settings.DATABASE_PORT:
    4345                conn_string += " port=%s" % settings.DATABASE_PORT
    4446            self.connection = Database.connect(conn_string, **self.options)
    45             self.connection.set_isolation_level(1) # make transactions transparent to all cursors
     47            self.connection.set_isolation_level(0) # autocommit
    4648        cursor = self.connection.cursor()
    4749        cursor.tzinfo_factory = None
    48         cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE])
     50        if first_cursor:
     51            cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE])
     52            cursor.execute("SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL READ COMMITTED")
     53            self._commit()
    4954        if settings.DEBUG:
    5055            return util.CursorDebugWrapper(cursor, self)
    5156        return cursor
Back to Top