Ticket #16255: 16255.1.diff
File 16255.1.diff, 5.9 KB (added by , 13 years ago) |
---|
-
django/db/backends/postgresql_psycopg2/base.py
diff --git a/django/db/backends/postgresql_psycopg2/base.py b/django/db/backends/postgresql_psycopg2/base.py
a b 145 145 # No savepoint support for earlier version of PostgreSQL. 146 146 self.features.uses_savepoints = False 147 147 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 148 # FIXME: Eventually we'll enable this by default for 149 # versions that support it, but, right now, that's hard to 150 # do without breaking other things (#10509). 151 self.features.can_return_id_from_insert = True 158 152 return CursorWrapper(cursor) 159 153 160 154 def _enter_transaction_management(self, managed): -
django/db/backends/postgresql_psycopg2/operations.py
diff --git a/django/db/backends/postgresql_psycopg2/operations.py b/django/db/backends/postgresql_psycopg2/operations.py
a b 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 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: -
docs/ref/databases.txt
diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt
a b 16 16 PostgreSQL notes 17 17 ================ 18 18 19 .. versionchanged:: 1. 319 .. 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 ----------------------- -
docs/releases/1.4.txt
diff --git a/docs/releases/1.4.txt b/docs/releases/1.4.txt
a b 363 363 Some legacy ways of calling :func:`~django.views.decorators.cache.cache_page` 364 364 have been deprecated, please see the docs for the correct way to use this 365 365 decorator. 366 367 Support for PostgreSQL version older than 8.2 368 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 369 370 Django 1.3 dropped support for PostgreSQL versions older than 8.0 and the 371 relevant documents suggested to use 8.2 because of performance reasons but more 372 importantly because of the end of the support periods for releases 8.0 373 and 8.1 (November 2010.) 374 375 Django 1.4 takes that policy further and sets 8.2 as the minimum PostgreSQL 376 version it officially supports.