Fixed #8592 -- Fixed a bug in the way savepoint usage was disabled for

PostgreSQL < 8.0.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8648 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2008-08-28 06:49:00 +00:00
parent 59607bb1c1
commit 21672c26bf
2 changed files with 8 additions and 10 deletions

View File

@ -117,11 +117,10 @@ class DatabaseWrapper(BaseDatabaseWrapper):
if set_tz: if set_tz:
cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE]) cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE])
if not hasattr(self, '_version'): if not hasattr(self, '_version'):
version = get_version(cursor) self.__class__._version = get_version(cursor)
self.__class__._version = version if self._version < (8, 0):
if 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
cursor.execute("SET client_encoding to 'UNICODE'") cursor.execute("SET client_encoding to 'UNICODE'")
cursor = UnicodeCursorWrapper(cursor, 'utf-8') cursor = UnicodeCursorWrapper(cursor, 'utf-8')
return cursor return cursor

View File

@ -89,9 +89,8 @@ class DatabaseWrapper(BaseDatabaseWrapper):
if set_tz: if set_tz:
cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE]) cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE])
if not hasattr(self, '_version'): if not hasattr(self, '_version'):
version = get_version(cursor) self.__class__._version = get_version(cursor)
self.__class__._version = version if self._version < (8, 0):
if 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
return cursor return cursor