Author: ramiro
Date: 2011-06-16 13:05:25 -0700 (Thu, 16 Jun 2011)
New Revision: 16423

Modified:
   django/trunk/django/db/backends/postgresql_psycopg2/base.py
   django/trunk/django/db/backends/postgresql_psycopg2/operations.py
   django/trunk/docs/ref/databases.txt
   django/trunk/docs/releases/1.4.txt
Log:
Fixed #16255 -- Raised minimum PostgreSQL version supported to 8.2.

Modified: django/trunk/django/db/backends/postgresql_psycopg2/base.py
===================================================================
--- django/trunk/django/db/backends/postgresql_psycopg2/base.py 2011-06-16 
19:56:22 UTC (rev 16422)
+++ django/trunk/django/db/backends/postgresql_psycopg2/base.py 2011-06-16 
20:05:25 UTC (rev 16423)
@@ -141,20 +141,11 @@
                 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):

Modified: django/trunk/django/db/backends/postgresql_psycopg2/operations.py
===================================================================
--- django/trunk/django/db/backends/postgresql_psycopg2/operations.py   
2011-06-16 19:56:22 UTC (rev 16422)
+++ django/trunk/django/db/backends/postgresql_psycopg2/operations.py   
2011-06-16 20:05:25 UTC (rev 16423)
@@ -84,23 +84,13 @@
 
     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 @@
     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:

Modified: django/trunk/docs/ref/databases.txt
===================================================================
--- django/trunk/docs/ref/databases.txt 2011-06-16 19:56:22 UTC (rev 16422)
+++ django/trunk/docs/ref/databases.txt 2011-06-16 20:05:25 UTC (rev 16423)
@@ -16,22 +16,10 @@
 PostgreSQL notes
 ================
 
-.. versionchanged:: 1.3
+.. versionchanged:: 1.4
 
-Django supports PostgreSQL 8.0 and higher. If you want to use
-:ref:`database-level autocommit <postgresql-autocommit-mode>`, a
-minimum version of PostgreSQL 8.2 is required.
+Django supports PostgreSQL 8.2 and higher.
 
-.. admonition:: Improvements in recent PostgreSQL versions
-
-    PostgreSQL 8.0 and 8.1 `will soon reach end-of-life`_; there have
-    also been a number of significant performance improvements added
-    in recent PostgreSQL versions. Although PostgreSQL 8.0 is the minimum
-    supported version, you would be well advised to use a more recent
-    version if at all possible.
-
-.. _will soon reach end-of-life: 
http://wiki.postgresql.org/wiki/PostgreSQL_Release_Support_Policy
-
 PostgreSQL 8.2 to 8.2.4
 -----------------------
 

Modified: django/trunk/docs/releases/1.4.txt
===================================================================
--- django/trunk/docs/releases/1.4.txt  2011-06-16 19:56:22 UTC (rev 16422)
+++ django/trunk/docs/releases/1.4.txt  2011-06-16 20:05:25 UTC (rev 16423)
@@ -376,3 +376,14 @@
 Some legacy ways of calling :func:`~django.views.decorators.cache.cache_page`
 have been deprecated, please see the docs for the correct way to use this
 decorator.
+
+Support for PostgreSQL versions older than 8.2
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Django 1.3 dropped support for PostgreSQL versions older than 8.0 and the
+relevant documents suggested to use a recent version because of performance
+reasons but more importantly because end of the upstream support periods for
+releases 8.0 and 8.1 was near (November 2010.)
+
+Django 1.4 takes that policy further and sets 8.2 as the minimum PostgreSQL
+version it officially supports.

-- 
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