From 21672c26bf4604e57de4b2a64ec92ef8de53b834 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Thu, 28 Aug 2008 06:49:00 +0000 Subject: [PATCH] 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 --- django/db/backends/postgresql/base.py | 9 ++++----- django/db/backends/postgresql_psycopg2/base.py | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py index 376d7ba2c8..ad271f2e38 100644 --- a/django/db/backends/postgresql/base.py +++ b/django/db/backends/postgresql/base.py @@ -117,11 +117,10 @@ class DatabaseWrapper(BaseDatabaseWrapper): if set_tz: cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE]) if not hasattr(self, '_version'): - version = get_version(cursor) - self.__class__._version = version - if version < (8, 0): - # No savepoint support for earlier version of PostgreSQL. - self.features.uses_savepoints = False + self.__class__._version = get_version(cursor) + if self._version < (8, 0): + # No savepoint support for earlier version of PostgreSQL. + self.features.uses_savepoints = False cursor.execute("SET client_encoding to 'UNICODE'") cursor = UnicodeCursorWrapper(cursor, 'utf-8') return cursor diff --git a/django/db/backends/postgresql_psycopg2/base.py b/django/db/backends/postgresql_psycopg2/base.py index 6ecf86b705..16104277c5 100644 --- a/django/db/backends/postgresql_psycopg2/base.py +++ b/django/db/backends/postgresql_psycopg2/base.py @@ -89,9 +89,8 @@ class DatabaseWrapper(BaseDatabaseWrapper): if set_tz: cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE]) if not hasattr(self, '_version'): - version = get_version(cursor) - self.__class__._version = version - if version < (8, 0): - # No savepoint support for earlier version of PostgreSQL. - self.features.uses_savepoints = False + self.__class__._version = get_version(cursor) + if self._version < (8, 0): + # No savepoint support for earlier version of PostgreSQL. + self.features.uses_savepoints = False return cursor