Author: mtredinnick
Date: 2009-03-12 00:32:00 -0500 (Thu, 12 Mar 2009)
New Revision: 10035

Modified:
   django/trunk/django/db/backends/postgresql_psycopg2/base.py
Log:
Fixed #10467 -- Fixed generated INSERT SQL for PostgreSQL 8.1 and earlier.

I introduced a bad regression in r10029, forgetting to check that some
syntax was supported. For now, you can't use autocommit=True with 8.1
and earlier (it's still available for later versions). I'll fix the
broader issue later and re-enable it for those versions, but I want to
get the SQL regression for the default path out of the code right now.

Modified: django/trunk/django/db/backends/postgresql_psycopg2/base.py
===================================================================
--- django/trunk/django/db/backends/postgresql_psycopg2/base.py 2009-03-12 
05:31:34 UTC (rev 10034)
+++ django/trunk/django/db/backends/postgresql_psycopg2/base.py 2009-03-12 
05:32:00 UTC (rev 10035)
@@ -105,6 +105,15 @@
             if self._version < (8, 0):
                 # No savepoint support for earlier version of PostgreSQL.
                 self.features.uses_savepoints = False
+            if self._version < (8, 2):
+                # Cannot return the insert ID as part of an INSERT statement
+                # prior to version 8.2.
+                self.features.can_return_id_from_insert = False
+                if self.features.uses_autocommit:
+                    # FIXME: Needs extra code to do reliable model insert
+                    # handling, so we forbid it for now.
+                    from django.core.exceptions import ImproperlyConfigured
+                    raise ImproperlyConfigured("You cannot use autocommit=True 
with PostgreSQL prior to 8.2 at the moment.")
         return 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