Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
  • Loading branch information...
commit b870bf6b9a4ac44331e97bce8b95cc44447580fa 1 parent b2f5efc
Ramiro Morales authored June 16, 2011
17  django/db/backends/postgresql_psycopg2/base.py
@@ -141,20 +141,11 @@ def _cursor(self):
141 141
                 cursor.execute("SET TIME ZONE %s", [settings_dict['TIME_ZONE']])
142 142
             if not hasattr(self, '_version'):
143 143
                 self.__class__._version = get_version(cursor)
144  
-            if self._version[0:2] < (8, 0):
145  
-                # No savepoint support for earlier version of PostgreSQL.
146  
-                self.features.uses_savepoints = False
147 144
             if self.features.uses_autocommit:
148  
-                if self._version[0:2] < (8, 2):
149  
-                    # FIXME: Needs extra code to do reliable model insert
150  
-                    # handling, so we forbid it for now.
151  
-                    from django.core.exceptions import ImproperlyConfigured
152  
-                    raise ImproperlyConfigured("You cannot use autocommit=True with PostgreSQL prior to 8.2 at the moment.")
153  
-                else:
154  
-                    # FIXME: Eventually we're enable this by default for
155  
-                    # versions that support it, but, right now, that's hard to
156  
-                    # do without breaking other things (#10509).
157  
-                    self.features.can_return_id_from_insert = True
  145
+                # FIXME: Eventually we'll enable this by default for
  146
+                # versions that support it, but, right now, that's hard to
  147
+                # do without breaking other things (#10509).
  148
+                self.features.can_return_id_from_insert = True
158 149
         return CursorWrapper(cursor)
159 150
 
160 151
     def _enter_transaction_management(self, managed):
31  django/db/backends/postgresql_psycopg2/operations.py
@@ -84,23 +84,13 @@ def quote_name(self, name):
84 84
 
85 85
     def sql_flush(self, style, tables, sequences):
86 86
         if tables:
87  
-            if self.postgres_version[0:2] >= (8,1):
88  
-                # Postgres 8.1+ can do 'TRUNCATE x, y, z...;'. In fact, it *has to*
89  
-                # in order to be able to truncate tables referenced by a foreign
90  
-                # key in any other table. The result is a single SQL TRUNCATE
91  
-                # statement.
92  
-                sql = ['%s %s;' % \
93  
-                    (style.SQL_KEYWORD('TRUNCATE'),
94  
-                     style.SQL_FIELD(', '.join([self.quote_name(table) for table in tables]))
95  
-                )]
96  
-            else:
97  
-                # Older versions of Postgres can't do TRUNCATE in a single call, so
98  
-                # they must use a simple delete.
99  
-                sql = ['%s %s %s;' % \
100  
-                        (style.SQL_KEYWORD('DELETE'),
101  
-                         style.SQL_KEYWORD('FROM'),
102  
-                         style.SQL_FIELD(self.quote_name(table))
103  
-                         ) for table in tables]
  87
+            # Perform a single SQL 'TRUNCATE x, y, z...;' statement.  It allows
  88
+            # us to truncate tables referenced by a foreign key in any other
  89
+            # table.
  90
+            sql = ['%s %s;' % \
  91
+                (style.SQL_KEYWORD('TRUNCATE'),
  92
+                    style.SQL_FIELD(', '.join([self.quote_name(table) for table in tables]))
  93
+            )]
104 94
 
105 95
             # 'ALTER SEQUENCE sequence_name RESTART WITH 1;'... style SQL statements
106 96
             # to reset sequence indices
@@ -171,17 +161,10 @@ def prep_for_iexact_query(self, x):
171 161
     def check_aggregate_support(self, aggregate):
172 162
         """Check that the backend fully supports the provided aggregate.
173 163
 
174  
-        The population and sample statistics (STDDEV_POP, STDDEV_SAMP,
175  
-        VAR_POP, VAR_SAMP) were first implemented in Postgres 8.2.
176  
-
177 164
         The implementation of population statistics (STDDEV_POP and VAR_POP)
178 165
         under Postgres 8.2 - 8.2.4 is known to be faulty. Raise
179 166
         NotImplementedError if this is the database in use.
180 167
         """
181  
-        if aggregate.sql_function in ('STDDEV_POP', 'STDDEV_SAMP', 'VAR_POP', 'VAR_SAMP'):
182  
-            if self.postgres_version[0:2] < (8,2):
183  
-                raise NotImplementedError('PostgreSQL does not support %s prior to version 8.2. Please upgrade your version of PostgreSQL.' % aggregate.sql_function)
184  
-
185 168
         if aggregate.sql_function in ('STDDEV_POP', 'VAR_POP'):
186 169
             if self.postgres_version[0:2] == (8,2):
187 170
                 if self.postgres_version[2] is None or self.postgres_version[2] <= 4:
16  docs/ref/databases.txt
@@ -16,21 +16,9 @@ documentation or reference manuals.
16 16
 PostgreSQL notes
17 17
 ================
18 18
 
19  
-.. versionchanged:: 1.3
  19
+.. versionchanged:: 1.4
20 20
 
21  
-Django supports PostgreSQL 8.0 and higher. If you want to use
22  
-:ref:`database-level autocommit <postgresql-autocommit-mode>`, a
23  
-minimum version of PostgreSQL 8.2 is required.
24  
-
25  
-.. admonition:: Improvements in recent PostgreSQL versions
26  
-
27  
-    PostgreSQL 8.0 and 8.1 `will soon reach end-of-life`_; there have
28  
-    also been a number of significant performance improvements added
29  
-    in recent PostgreSQL versions. Although PostgreSQL 8.0 is the minimum
30  
-    supported version, you would be well advised to use a more recent
31  
-    version if at all possible.
32  
-
33  
-.. _will soon reach end-of-life: http://wiki.postgresql.org/wiki/PostgreSQL_Release_Support_Policy
  21
+Django supports PostgreSQL 8.2 and higher.
34 22
 
35 23
 PostgreSQL 8.2 to 8.2.4
36 24
 -----------------------
11  docs/releases/1.4.txt
@@ -376,3 +376,14 @@ Old styles of calling ``cache_page`` decorator
376 376
 Some legacy ways of calling :func:`~django.views.decorators.cache.cache_page`
377 377
 have been deprecated, please see the docs for the correct way to use this
378 378
 decorator.
  379
+
  380
+Support for PostgreSQL versions older than 8.2
  381
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  382
+
  383
+Django 1.3 dropped support for PostgreSQL versions older than 8.0 and the
  384
+relevant documents suggested to use a recent version because of performance
  385
+reasons but more importantly because end of the upstream support periods for
  386
+releases 8.0 and 8.1 was near (November 2010.)
  387
+
  388
+Django 1.4 takes that policy further and sets 8.2 as the minimum PostgreSQL
  389
+version it officially supports.

0 notes on commit b870bf6

Please sign in to comment.
Something went wrong with that request. Please try again.