Author: ramiro
Date: 2011-06-19 12:54:20 -0700 (Sun, 19 Jun 2011)
New Revision: 16443

Modified:
   django/trunk/django/db/backends/postgresql_psycopg2/base.py
Log:
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].

Modified: django/trunk/django/db/backends/postgresql_psycopg2/base.py
===================================================================
--- django/trunk/django/db/backends/postgresql_psycopg2/base.py 2011-06-19 
19:40:50 UTC (rev 16442)
+++ django/trunk/django/db/backends/postgresql_psycopg2/base.py 2011-06-19 
19:54:20 UTC (rev 16443)
@@ -66,7 +66,7 @@
 
 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 @@
             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):

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to