Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/check-migrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

services:
postgres:
image: postgres:15-alpine
image: postgres:16-alpine
env:
POSTGRES_DB: django
POSTGRES_USER: user
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
timeout-minutes: 60
services:
postgres:
image: postgres:15-alpine
image: postgres:16-alpine
env:
POSTGRES_DB: django
POSTGRES_USER: user
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/schedule_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ jobs:
timeout-minutes: 60
services:
postgres:
image: postgres:15-alpine
image: postgres:16-alpine
env:
POSTGRES_DB: django
POSTGRES_USER: user
Expand Down Expand Up @@ -169,7 +169,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [16, 17, 18]
version: [17, 18]
server_side_bindings: [0, 1]
runs-on: ubuntu-latest
name: PostgreSQL Versions
Expand Down
2 changes: 1 addition & 1 deletion django/contrib/gis/db/backends/postgis/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def spatial_version(self):
raise ImproperlyConfigured(
'Cannot determine PostGIS version for database "%s" '
'using command "SELECT postgis_lib_version()". '
"GeoDjango requires at least PostGIS version 3.2. "
"GeoDjango requires at least PostGIS version 3.3. "
"Was the database created from a spatial database "
"template?" % self.connection.settings_dict["NAME"]
)
Expand Down
8 changes: 2 additions & 6 deletions django/db/backends/postgresql/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


class DatabaseFeatures(BaseDatabaseFeatures):
minimum_database_version = (15,)
minimum_database_version = (16,)
allows_group_by_selected_pks = True
can_return_columns_from_insert = True
can_return_rows_from_bulk_insert = True
Expand Down Expand Up @@ -174,10 +174,6 @@ def introspected_field_types(self):
"PositiveSmallIntegerField": "SmallIntegerField",
}

@cached_property
def is_postgresql_16(self):
return self.connection.pg_version >= 160000

@cached_property
def is_postgresql_17(self):
return self.connection.pg_version >= 170000
Expand All @@ -187,7 +183,7 @@ def is_postgresql_18(self):
return self.connection.pg_version >= 180000

supports_unlimited_charfield = True
supports_any_value = property(operator.attrgetter("is_postgresql_16"))
supports_any_value = True
supports_virtual_generated_columns = property(
operator.attrgetter("is_postgresql_18")
)
Expand Down
26 changes: 3 additions & 23 deletions django/db/models/functions/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,8 @@ def as_postgresql(self, compiler, connection, **extra_context):
for expression in casted_obj.get_source_expressions()
]
)

if connection.features.is_postgresql_16:
return casted_obj.as_native(
compiler, connection, returning="JSONB", **extra_context
)

return casted_obj.as_sql(
compiler,
connection,
function="JSONB_BUILD_ARRAY",
**extra_context,
return casted_obj.as_native(
compiler, connection, returning="JSONB", **extra_context
)

def as_oracle(self, compiler, connection, **extra_context):
Expand Down Expand Up @@ -107,18 +98,7 @@ def as_postgresql(self, compiler, connection, **extra_context):
for index, expression in enumerate(copy.get_source_expressions())
]
)

if connection.features.is_postgresql_16:
return copy.as_native(
compiler, connection, returning="JSONB", **extra_context
)

return super(JSONObject, copy).as_sql(
compiler,
connection,
function="JSONB_BUILD_OBJECT",
**extra_context,
)
return copy.as_native(compiler, connection, returning="JSONB", **extra_context)

def as_oracle(self, compiler, connection, **extra_context):
return self.as_native(compiler, connection, returning="CLOB", **extra_context)
3 changes: 1 addition & 2 deletions docs/ref/contrib/gis/install/geolibs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Program Description Required
`PROJ`_ Cartographic Projections library Yes (PostgreSQL and SQLite only) 9.x, 8.x, 7.x, 6.x
:ref:`GDAL <gdal-overview>` Geospatial Data Abstraction Library Yes 3.13, 3.12, 3.11, 3.10, 3.9, 3.8, 3.7, 3.6, 3.5, 3.4, 3.3
:ref:`GeoIP <geoip2-overview>` IP-based geolocation library No 2
`PostGIS`__ Spatial extensions for PostgreSQL Yes (PostgreSQL only) 3.6, 3.5, 3.4, 3.3, 3.2
`PostGIS`__ Spatial extensions for PostgreSQL Yes (PostgreSQL only) 3.6, 3.5, 3.4, 3.3
`SpatiaLite`__ Spatial extensions for SQLite Yes (SQLite only) 5.1, 5.0, 4.3
============================== ==================================== ================================ =========================================================

Expand All @@ -42,7 +42,6 @@ totally fine with GeoDjango. Your mileage may vary.
GDAL 3.11.0 2025-05-09
GDAL 3.12.0 2025-11-07
GDAL 3.13.0 2026-05-08
PostGIS 3.2.0 2021-12-18
PostGIS 3.3.0 2022-08-27
PostGIS 3.4.0 2023-08-15
PostGIS 3.5.0 2024-09-25
Expand Down
18 changes: 9 additions & 9 deletions docs/ref/contrib/gis/install/index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ supported versions, and any notes for each of the supported database backends:
================== ============================== ================== =========================================
Database Library Requirements Supported Versions Notes
================== ============================== ================== =========================================
PostgreSQL GEOS, GDAL, PROJ, PostGIS 15+ Requires PostGIS.
PostgreSQL GEOS, GDAL, PROJ, PostGIS 16+ Requires PostGIS.
MySQL GEOS, GDAL 8.4+ :ref:`Limited functionality <mysql-spatial-limitations>`.
Oracle GEOS, GDAL 19+ XE not supported.
SQLite GEOS, GDAL, PROJ, SpatiaLite 3.37.0+ Requires SpatiaLite 4.3+
Expand Down Expand Up @@ -304,7 +304,7 @@ Summary:

.. code-block:: shell

$ sudo port install postgresql15-server
$ sudo port install postgresql16-server
$ sudo port install geos
$ sudo port install proj6
$ sudo port install postgis3
Expand All @@ -317,14 +317,14 @@ Summary:

.. code-block:: shell

export PATH=/opt/local/bin:/opt/local/lib/postgresql15/bin
export PATH=/opt/local/bin:/opt/local/lib/postgresql16/bin

In addition, add the ``DYLD_FALLBACK_LIBRARY_PATH`` setting so that
the libraries can be found by Python:

.. code-block:: shell

export DYLD_FALLBACK_LIBRARY_PATH=/opt/local/lib:/opt/local/lib/postgresql15
export DYLD_FALLBACK_LIBRARY_PATH=/opt/local/lib:/opt/local/lib/postgresql16

__ https://www.macports.org/

Expand All @@ -346,7 +346,7 @@ for further information.
PostgreSQL
~~~~~~~~~~

Download the latest `PostgreSQL 15.x installer`__ from the
Download the latest `PostgreSQL 16.x installer`__ from the
`EnterpriseDB`__ website. After downloading, run the installer, follow the
on-screen directions, and keep the default options unless you know the
consequences of changing them.
Expand All @@ -363,7 +363,7 @@ keep this checked, as it is necessary to install :ref:`postgisasb`.

If installed successfully, the PostgreSQL server will run in the background
each time the system is started as a Windows service. A
:menuselection:`PostgreSQL 15` start menu group will created and contains
:menuselection:`PostgreSQL 16` start menu group will created and contains
shortcuts for the Application Stack Builder (ASB) as well as the
'SQL Shell', which will launch a ``psql`` command window.

Expand All @@ -376,11 +376,11 @@ PostGIS
~~~~~~~

From within the Stack Builder (to run outside of the installer,
:menuselection:`Start --> PostgreSQL 15 --> Application Stack Builder`), select
:menuselection:`PostgreSQL 15 (x64) on port 5432` from the drop down
:menuselection:`Start --> PostgreSQL 16 --> Application Stack Builder`), select
:menuselection:`PostgreSQL 16 (x64) on port 5432` from the drop down
menu and click next. Expand the
:menuselection:`Categories --> Spatial Extensions` menu tree and select
:menuselection:`PostGIS X.Y for PostgreSQL 15`.
:menuselection:`PostGIS X.Y for PostgreSQL 16`.

After clicking next, you will be prompted to confirm the selected package and
"Download directory". Click next again, this will download PostGIS and you will
Expand Down
2 changes: 1 addition & 1 deletion docs/ref/databases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ below for information on how to set up your database correctly.
PostgreSQL notes
================

Django supports PostgreSQL 15 and higher. `psycopg`_ 3.1.12+ or `psycopg2`_
Django supports PostgreSQL 16 and higher. `psycopg`_ 3.1.12+ or `psycopg2`_
2.9.9+ is required, though the latest `psycopg`_ 3.1.12+ is recommended.

.. note::
Expand Down
8 changes: 8 additions & 0 deletions docs/releases/6.2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ backends.
:meth:`~django.contrib.gis.gdal.Field.as_datetime` is now a ``c_float``
rather than a ``c_int``.

* Support for PostGIS 3.2 is removed.

Models
------

Expand All @@ -322,6 +324,12 @@ Tests

* The undocumented ``django.test.selenium`` module was removed.

Dropped support for PostgreSQL 15
---------------------------------

Upstream support for PostgreSQL 15 ends in November 2027. Django 6.2 supports
PostgreSQL 16 and higher.

Miscellaneous
-------------

Expand Down
8 changes: 4 additions & 4 deletions tests/backends/postgresql/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,12 +579,12 @@ def test_copy_cursors(self):

def test_get_database_version(self):
new_connection = no_pool_connection()
new_connection.pg_version = 150009
self.assertEqual(new_connection.get_database_version(), (15, 9))
new_connection.pg_version = 160009
self.assertEqual(new_connection.get_database_version(), (16, 9))

@mock.patch.object(connection, "get_database_version", return_value=(14,))
@mock.patch.object(connection, "get_database_version", return_value=(15,))
def test_check_database_version_supported(self, mocked_get_database_version):
msg = "PostgreSQL 15 or later is required (found 14)."
msg = "PostgreSQL 16 or later is required (found 15)."
with self.assertRaisesMessage(NotSupportedError, msg):
connection.check_database_version_supported()
self.assertTrue(mocked_get_database_version.called)
Expand Down
3 changes: 1 addition & 2 deletions tests/queries/test_explain.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,8 @@ def test_postgres_options(self):
{"summary": True},
{"settings": True},
{"analyze": True, "wal": True},
{"generic_plan": True},
]
if connection.features.is_postgresql_16:
test_options.append({"generic_plan": True})
if connection.features.is_postgresql_17:
test_options.append({"memory": True})
test_options.append({"serialize": "TEXT", "analyze": True})
Expand Down
1 change: 1 addition & 0 deletions tests/schema/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1113,6 +1113,7 @@ class Meta:

@isolate_apps("schema")
@skipUnlessDBFeature(
"supports_comments",
"supports_stored_generated_columns",
"supports_independent_comment_alteration",
)
Expand Down
Loading