diff options
| author | Ramiro Morales <cramm0@gmail.com> | 2011-06-19 19:54:20 +0000 |
|---|---|---|
| committer | Ramiro Morales <cramm0@gmail.com> | 2011-06-19 19:54:20 +0000 |
| commit | 9eb2afddfa0165d69f3e506122c2aa2b68618591 (patch) | |
| tree | ddcb6699daf01cd4f05d65a810e4fa063f102089 | |
| parent | b9ea5e163e4aff4fafaa863ee9d10614a92c564a (diff) | |
Removed more code for handling of PostgreSQL versions older than 8.2; use always "INSERT... RETURNING..." rather than "INSERT...; SELECT CURRVAL...". Thanks Christoph Pettus for the report and hints. Fixes #12180. Refs [16423].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16443 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/db/backends/postgresql_psycopg2/base.py | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/django/db/backends/postgresql_psycopg2/base.py b/django/db/backends/postgresql_psycopg2/base.py index 5a94c815bd..d25a2fe1ff 100644 --- a/django/db/backends/postgresql_psycopg2/base.py +++ b/django/db/backends/postgresql_psycopg2/base.py @@ -66,7 +66,7 @@ class CursorWrapper(object): class DatabaseFeatures(BaseDatabaseFeatures): needs_datetime_string_cast = False - can_return_id_from_insert = False + can_return_id_from_insert = True requires_rollback_on_dirty_transaction = True has_real_datatype = True can_defer_constraint_checks = True @@ -147,11 +147,6 @@ class DatabaseWrapper(BaseDatabaseWrapper): if set_tz: cursor.execute("SET TIME ZONE %s", [settings_dict['TIME_ZONE']]) self._get_pg_version() - if self.features.uses_autocommit: - # FIXME: Eventually we'll enable this by default for - # versions that support it, but, right now, that's hard to - # do without breaking other things (#10509). - self.features.can_return_id_from_insert = True return CursorWrapper(cursor) def _enter_transaction_management(self, managed): |
