Ticket #12180: 12180-2.diff

File 12180-2.diff, 1.3 KB (added by Christophe Pettus, 15 years ago)

Improved patch (removed some now-redundant code)

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

     
    6767        autocommit = self.settings_dict["DATABASE_OPTIONS"].get('autocommit', False)
    6868        self.features.uses_autocommit = autocommit
    6969        self._set_isolation_level(int(not autocommit))
     70        self.features.can_return_id_from_insert = autocommit
    7071        self.ops = DatabaseOperations()
    7172        self.client = DatabaseClient(self)
    7273        self.creation = DatabaseCreation(self)
     
    114115                    # handling, so we forbid it for now.
    115116                    from django.core.exceptions import ImproperlyConfigured
    116117                    raise ImproperlyConfigured("You cannot use autocommit=True with PostgreSQL prior to 8.2 at the moment.")
    117                 else:
    118                     # FIXME: Eventually we're enable this by default for
    119                     # versions that support it, but, right now, that's hard to
    120                     # do without breaking other things (#10509).
    121                     self.features.can_return_id_from_insert = True
    122118        return cursor
    123119
    124120    def _enter_transaction_management(self, managed):
Back to Top