Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #19968 -- Dropped support for PostgreSQL < 8.4. #911

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions django/db/backends/postgresql_psycopg2/operations.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def __init__(self, connection):
super(DatabaseOperations, self).__init__(connection) super(DatabaseOperations, self).__init__(connection)


def date_extract_sql(self, lookup_type, field_name): def date_extract_sql(self, lookup_type, field_name):
# http://www.postgresql.org/docs/8.0/static/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT # http://www.postgresql.org/docs/current/static/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT
if lookup_type == 'week_day': if lookup_type == 'week_day':
# For consistency across backends, we return Sunday=1, Saturday=7. # For consistency across backends, we return Sunday=1, Saturday=7.
return "EXTRACT('dow' FROM %s) + 1" % field_name return "EXTRACT('dow' FROM %s) + 1" % field_name
Expand All @@ -34,7 +34,7 @@ def date_interval_sql(self, sql, connector, timedelta):
return '(%s)' % conn.join([sql, 'interval \'%s\'' % mods]) return '(%s)' % conn.join([sql, 'interval \'%s\'' % mods])


def date_trunc_sql(self, lookup_type, field_name): def date_trunc_sql(self, lookup_type, field_name):
# http://www.postgresql.org/docs/8.0/static/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC # http://www.postgresql.org/docs/current/static/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC
return "DATE_TRUNC('%s', %s)" % (lookup_type, field_name) return "DATE_TRUNC('%s', %s)" % (lookup_type, field_name)


def datetime_extract_sql(self, lookup_type, field_name, tzname): def datetime_extract_sql(self, lookup_type, field_name, tzname):
Expand All @@ -43,7 +43,7 @@ def datetime_extract_sql(self, lookup_type, field_name, tzname):
params = [tzname] params = [tzname]
else: else:
params = [] params = []
# http://www.postgresql.org/docs/8.0/static/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT # http://www.postgresql.org/docs/current/static/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT
if lookup_type == 'week_day': if lookup_type == 'week_day':
# For consistency across backends, we return Sunday=1, Saturday=7. # For consistency across backends, we return Sunday=1, Saturday=7.
sql = "EXTRACT('dow' FROM %s) + 1" % field_name sql = "EXTRACT('dow' FROM %s) + 1" % field_name
Expand All @@ -57,7 +57,7 @@ def datetime_trunc_sql(self, lookup_type, field_name, tzname):
params = [tzname] params = [tzname]
else: else:
params = [] params = []
# http://www.postgresql.org/docs/8.0/static/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC # http://www.postgresql.org/docs/current/static/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC
sql = "DATE_TRUNC('%s', %s)" % (lookup_type, field_name) sql = "DATE_TRUNC('%s', %s)" % (lookup_type, field_name)
return sql, params return sql, params


Expand Down Expand Up @@ -178,17 +178,6 @@ def sequence_reset_sql(self, style, model_list):
def prep_for_iexact_query(self, x): def prep_for_iexact_query(self, x):
return x return x


def check_aggregate_support(self, aggregate):
"""Check that the backend fully supports the provided aggregate.

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', 'VAR_POP'):
if 80200 <= self.connection.pg_version <= 80204:
raise NotImplementedError('PostgreSQL 8.2 to 8.2.4 is known to have a faulty implementation of %s. Please upgrade your version of PostgreSQL.' % aggregate.sql_function)

def max_name_length(self): def max_name_length(self):
""" """
Returns the maximum length of an identifier. Returns the maximum length of an identifier.
Expand Down
2 changes: 1 addition & 1 deletion docs/howto/custom-model-fields.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ only the common types, such as ``VARCHAR`` and ``INTEGER``. For more obscure
column types, such as geographic polygons or even user-created types such as column types, such as geographic polygons or even user-created types such as
`PostgreSQL custom types`_, you can define your own Django ``Field`` subclasses. `PostgreSQL custom types`_, you can define your own Django ``Field`` subclasses.


.. _PostgreSQL custom types: http://www.postgresql.org/docs/8.2/interactive/sql-createtype.html .. _PostgreSQL custom types: http://www.postgresql.org/docs/current/interactive/sql-createtype.html


Alternatively, you may have a complex Python object that can somehow be Alternatively, you may have a complex Python object that can somehow be
serialized to fit into a standard database column type. This is another case serialized to fit into a standard database column type. This is another case
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@
GEOGRAPHY=0 GEOGRAPHY=0
POSTGIS_SQL=postgis.sql POSTGIS_SQL=postgis.sql


# For Ubuntu 8.x and 9.x releases.
if [ -d "/usr/share/postgresql-8.3-postgis" ]
then
POSTGIS_SQL_PATH=/usr/share/postgresql-8.3-postgis
POSTGIS_SQL=lwpostgis.sql
fi

# For Ubuntu 10.04 # For Ubuntu 10.04
if [ -d "/usr/share/postgresql/8.4/contrib" ] if [ -d "/usr/share/postgresql/8.4/contrib" ]
then then
Expand Down
2 changes: 1 addition & 1 deletion docs/ref/contrib/gis/install/index.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ supported versions, and any notes for each of the supported database backends:
================== ============================== ================== ========================================= ================== ============================== ================== =========================================
Database Library Requirements Supported Versions Notes Database Library Requirements Supported Versions Notes
================== ============================== ================== ========================================= ================== ============================== ================== =========================================
PostgreSQL GEOS, PROJ.4, PostGIS 8.2+ Requires PostGIS. PostgreSQL GEOS, PROJ.4, PostGIS 8.4+ Requires PostGIS.
MySQL GEOS 5.x Not OGC-compliant; :ref:`limited functionality <mysql-spatial-limitations>`. MySQL GEOS 5.x Not OGC-compliant; :ref:`limited functionality <mysql-spatial-limitations>`.
Oracle GEOS 10.2, 11 XE not supported; not tested with 9. Oracle GEOS 10.2, 11 XE not supported; not tested with 9.
SQLite GEOS, GDAL, PROJ.4, SpatiaLite 3.6.+ Requires SpatiaLite 2.3+, pysqlite2 2.5+ SQLite GEOS, GDAL, PROJ.4, SpatiaLite 3.6.+ Requires SpatiaLite 2.3+, pysqlite2 2.5+
Expand Down
19 changes: 3 additions & 16 deletions docs/ref/databases.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -77,20 +77,7 @@ negating the effect of persistent connections.
PostgreSQL notes PostgreSQL notes
================ ================


Django supports PostgreSQL 8.2 and higher. Django supports PostgreSQL 8.4 and higher.

PostgreSQL 8.2 to 8.2.4
-----------------------

The implementation of the population statistics aggregates ``STDDEV_POP`` and
``VAR_POP`` that shipped with PostgreSQL 8.2 to 8.2.4 are `known to be
faulty`_. Users of these releases of PostgreSQL are advised to upgrade to
`Release 8.2.5`_ or later. Django will raise a ``NotImplementedError`` if you
attempt to use the ``StdDev(sample=False)`` or ``Variance(sample=False)``
aggregate with a database backend that falls within the affected release range.

.. _known to be faulty: http://archives.postgresql.org/pgsql-bugs/2007-07/msg00046.php
.. _Release 8.2.5: http://www.postgresql.org/docs/devel/static/release-8-2-5.html


PostgreSQL connection settings PostgreSQL connection settings
------------------------------- -------------------------------
Expand Down Expand Up @@ -165,7 +152,7 @@ such as ``REPEATABLE READ`` or ``SERIALIZABLE``, set it in the
handle exceptions raised on serialization failures. This option is handle exceptions raised on serialization failures. This option is
designed for advanced uses. designed for advanced uses.


.. _postgresql-isolation-levels: http://www.postgresql.org/docs/devel/static/transaction-iso.html .. _postgresql-isolation-levels: http://www.postgresql.org/docs/current/static/transaction-iso.html


Indexes for ``varchar`` and ``text`` columns Indexes for ``varchar`` and ``text`` columns
-------------------------------------------- --------------------------------------------
Expand All @@ -179,7 +166,7 @@ for the column. The extra index is necessary to correctly perform
lookups that use the ``LIKE`` operator in their SQL, as is done with the lookups that use the ``LIKE`` operator in their SQL, as is done with the
``contains`` and ``startswith`` lookup types. ``contains`` and ``startswith`` lookup types.


.. _PostgreSQL operator class: http://www.postgresql.org/docs/8.4/static/indexes-opclass.html .. _PostgreSQL operator class: http://www.postgresql.org/docs/current/static/indexes-opclass.html


.. _mysql-notes: .. _mysql-notes:


Expand Down
2 changes: 1 addition & 1 deletion docs/ref/models/querysets.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ object. If it's ``None``, Django uses the :ref:`current time zone
- MySQL: load the time zone tables with `mysql_tzinfo_to_sql`_. - MySQL: load the time zone tables with `mysql_tzinfo_to_sql`_.


.. _pytz: http://pytz.sourceforge.net/ .. _pytz: http://pytz.sourceforge.net/
.. _Time Zones: http://www.postgresql.org/docs/9.2/static/datatype-datetime.html#DATATYPE-TIMEZONES .. _Time Zones: http://www.postgresql.org/docs/current/static/datatype-datetime.html#DATATYPE-TIMEZONES
.. _Choosing a Time Zone File: http://docs.oracle.com/cd/B19306_01/server.102/b14225/ch4datetime.htm#i1006667 .. _Choosing a Time Zone File: http://docs.oracle.com/cd/B19306_01/server.102/b14225/ch4datetime.htm#i1006667
.. _mysql_tzinfo_to_sql: http://dev.mysql.com/doc/refman/5.5/en/mysql-tzinfo-to-sql.html .. _mysql_tzinfo_to_sql: http://dev.mysql.com/doc/refman/5.5/en/mysql-tzinfo-to-sql.html


Expand Down
2 changes: 1 addition & 1 deletion docs/ref/settings.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ backend-specific.
Supported for the PostgreSQL_ (``postgresql_psycopg2``) and MySQL_ (``mysql``) Supported for the PostgreSQL_ (``postgresql_psycopg2``) and MySQL_ (``mysql``)
backends. backends.


.. _PostgreSQL: http://www.postgresql.org/docs/8.2/static/multibyte.html .. _PostgreSQL: http://www.postgresql.org/docs/current/static/multibyte.html
.. _MySQL: http://dev.mysql.com/doc/refman/5.0/en/charset-database.html .. _MySQL: http://dev.mysql.com/doc/refman/5.0/en/charset-database.html


.. setting:: TEST_COLLATION .. setting:: TEST_COLLATION
Expand Down
6 changes: 3 additions & 3 deletions docs/ref/unicode.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ able to store certain characters in the database, and information will be lost.
* MySQL users, refer to the `MySQL manual`_ (section 9.1.3.2 for MySQL 5.1) * MySQL users, refer to the `MySQL manual`_ (section 9.1.3.2 for MySQL 5.1)
for details on how to set or alter the database character set encoding. for details on how to set or alter the database character set encoding.


* PostgreSQL users, refer to the `PostgreSQL manual`_ (section 21.2.2 in * PostgreSQL users, refer to the `PostgreSQL manual`_ (section 22.3.2 in
PostgreSQL 8) for details on creating databases with the correct encoding. PostgreSQL 9) for details on creating databases with the correct encoding.


* SQLite users, there is nothing you need to do. SQLite always uses UTF-8 * SQLite users, there is nothing you need to do. SQLite always uses UTF-8
for internal encoding. for internal encoding.


.. _MySQL manual: http://dev.mysql.com/doc/refman/5.1/en/charset-database.html .. _MySQL manual: http://dev.mysql.com/doc/refman/5.1/en/charset-database.html
.. _PostgreSQL manual: http://www.postgresql.org/docs/8.2/static/multibyte.html#AEN24104 .. _PostgreSQL manual: http://www.postgresql.org/docs/current/static/multibyte.html


All of Django's database backends automatically convert Unicode strings into All of Django's database backends automatically convert Unicode strings into
the appropriate encoding for talking to the database. They also automatically the appropriate encoding for talking to the database. They also automatically
Expand Down
11 changes: 11 additions & 0 deletions docs/releases/1.6.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -347,6 +347,17 @@ in an external repository`__.
__ https://disqus.com/ __ https://disqus.com/
__ https://github.com/django/django-contrib-comments __ https://github.com/django/django-contrib-comments


Support for PostgreSQL versions older than 8.4
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The end of upstream support periods was reached in December 2011 for
PostgreSQL 8.2 and in February 2013 for 8.3. As a consequence, Django 1.6 sets
8.4 as the minimum PostgreSQL version it officially supports.

You're strongly encouraged to use the most recent version of PostgreSQL
available, because of performance improvements and to take advantage of the
native streaming replication available in PostgreSQL 9.x.

Changes to :ttag:`cycle` and :ttag:`firstof` Changes to :ttag:`cycle` and :ttag:`firstof`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Expand Down
2 changes: 1 addition & 1 deletion docs/topics/db/sql.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ of people with their ages calculated by the database::
Jane is 42. Jane is 42.
... ...


__ http://www.postgresql.org/docs/8.4/static/functions-datetime.html __ http://www.postgresql.org/docs/current/static/functions-datetime.html


Passing parameters into ``raw()`` Passing parameters into ``raw()``
--------------------------------- ---------------------------------
Expand Down