Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed #10467 -- Fixed generated INSERT SQL for PostgreSQL 8.1 and ear…
…lier.

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.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10035 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
malcolmt committed Mar 12, 2009
1 parent c663e8f commit a152909
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions django/db/backends/postgresql_psycopg2/base.py
Expand Up @@ -105,6 +105,15 @@ def _cursor(self):
if self._version < (8, 0): if self._version < (8, 0):
# No savepoint support for earlier version of PostgreSQL. # No savepoint support for earlier version of PostgreSQL.
self.features.uses_savepoints = False 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 return cursor


def _enter_transaction_management(self, managed): def _enter_transaction_management(self, managed):
Expand Down

0 comments on commit a152909

Please sign in to comment.