summaryrefslogtreecommitdiff
path: root/django/db
diff options
context:
space:
mode:
authorRamiro Morales <cramm0@gmail.com>2011-06-16 20:05:25 +0000
committerRamiro Morales <cramm0@gmail.com>2011-06-16 20:05:25 +0000
commitb870bf6b9a4ac44331e97bce8b95cc44447580fa (patch)
tree81021c0041fe258e8d682cb0c4353aee26bce314 /django/db
parentb2f5efc6ac59e3341b2d617510137707f214e18f (diff)
Fixed #16255 -- Raised minimum PostgreSQL version supported to 8.2.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16423 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db')
-rw-r--r--django/db/backends/postgresql_psycopg2/base.py17
-rw-r--r--django/db/backends/postgresql_psycopg2/operations.py31
2 files changed, 11 insertions, 37 deletions
diff --git a/django/db/backends/postgresql_psycopg2/base.py b/django/db/backends/postgresql_psycopg2/base.py
index 67e28774fe..4f6bcbf973 100644
--- a/django/db/backends/postgresql_psycopg2/base.py
+++ b/django/db/backends/postgresql_psycopg2/base.py
@@ -141,20 +141,11 @@ class DatabaseWrapper(BaseDatabaseWrapper):
cursor.execute("SET TIME ZONE %s", [settings_dict['TIME_ZONE']])
if not hasattr(self, '_version'):
self.__class__._version = get_version(cursor)
- if self._version[0:2] < (8, 0):
- # No savepoint support for earlier version of PostgreSQL.
- self.features.uses_savepoints = False
if self.features.uses_autocommit:
- if self._version[0:2] < (8, 2):
- # 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.")
- else:
- # FIXME: Eventually we're 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
+ # 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):
diff --git a/django/db/backends/postgresql_psycopg2/operations.py b/django/db/backends/postgresql_psycopg2/operations.py
index 33159133d6..ecd0dde1c6 100644
--- a/django/db/backends/postgresql_psycopg2/operations.py
+++ b/django/db/backends/postgresql_psycopg2/operations.py
@@ -84,23 +84,13 @@ class DatabaseOperations(BaseDatabaseOperations):
def sql_flush(self, style, tables, sequences):
if tables:
- if self.postgres_version[0:2] >= (8,1):
- # Postgres 8.1+ can do 'TRUNCATE x, y, z...;'. In fact, it *has to*
- # in order to be able to truncate tables referenced by a foreign
- # key in any other table. The result is a single SQL TRUNCATE
- # statement.
- sql = ['%s %s;' % \
- (style.SQL_KEYWORD('TRUNCATE'),
- style.SQL_FIELD(', '.join([self.quote_name(table) for table in tables]))
- )]
- else:
- # Older versions of Postgres can't do TRUNCATE in a single call, so
- # they must use a simple delete.
- sql = ['%s %s %s;' % \
- (style.SQL_KEYWORD('DELETE'),
- style.SQL_KEYWORD('FROM'),
- style.SQL_FIELD(self.quote_name(table))
- ) for table in tables]
+ # Perform a single SQL 'TRUNCATE x, y, z...;' statement. It allows
+ # us to truncate tables referenced by a foreign key in any other
+ # table.
+ sql = ['%s %s;' % \
+ (style.SQL_KEYWORD('TRUNCATE'),
+ style.SQL_FIELD(', '.join([self.quote_name(table) for table in tables]))
+ )]
# 'ALTER SEQUENCE sequence_name RESTART WITH 1;'... style SQL statements
# to reset sequence indices
@@ -171,17 +161,10 @@ class DatabaseOperations(BaseDatabaseOperations):
def check_aggregate_support(self, aggregate):
"""Check that the backend fully supports the provided aggregate.
- The population and sample statistics (STDDEV_POP, STDDEV_SAMP,
- VAR_POP, VAR_SAMP) were first implemented in Postgres 8.2.
-
The implementation of population statistics (STDDEV_POP and VAR_POP)
under Postgres 8.2 - 8.2.4 is known to be faulty. Raise
NotImplementedError if this is the database in use.
"""
- if aggregate.sql_function in ('STDDEV_POP', 'STDDEV_SAMP', 'VAR_POP', 'VAR_SAMP'):
- if self.postgres_version[0:2] < (8,2):
- raise NotImplementedError('PostgreSQL does not support %s prior to version 8.2. Please upgrade your version of PostgreSQL.' % aggregate.sql_function)
-
if aggregate.sql_function in ('STDDEV_POP', 'VAR_POP'):
if self.postgres_version[0:2] == (8,2):
if self.postgres_version[2] is None or self.postgres_version[2] <= 4: