From 5d545d16260288154a6e36b410beca9cbdb925d6 Mon Sep 17 00:00:00 2001 From: Devon Hudson Date: Thu, 13 Nov 2025 19:38:59 +0000 Subject: [PATCH] Remove support for PostgreSQL 13 (#19170) This PR removes support for PostgreSQL 13 as it is deprecated (tomorrow). Uses https://github.com/element-hq/synapse/pull/18034 as a reference of where to look, and also found a few other places that needed updating. I didn't see anywhere in Complement that needs updating. There is a companion Sytest PR deprecating psql13 over there: https://github.com/matrix-org/sytest/pull/1418 ### Pull Request Checklist * [X] Pull request is based on the develop branch * [X] Pull request includes a [changelog file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog). The entry should: - Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from `EventStore` to `EventWorkerStore`.". - Use markdown where necessary, mostly for `code blocks`. - End with either a period (.) or an exclamation mark (!). - Start with a capital letter. - Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry. * [X] [Code style](https://element-hq.github.io/synapse/latest/code_style.html) is correct (run the [linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters)) --- .ci/scripts/calculate_jobs.py | 2 +- .github/workflows/tests.yml | 2 +- changelog.d/19170.removal | 1 + docker/complement/Dockerfile | 4 ++-- docs/upgrade.md | 8 ++++++++ synapse/storage/engines/postgres.py | 4 ++-- 6 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 changelog.d/19170.removal diff --git a/.ci/scripts/calculate_jobs.py b/.ci/scripts/calculate_jobs.py index 810d41bfd4..1ddea715b0 100755 --- a/.ci/scripts/calculate_jobs.py +++ b/.ci/scripts/calculate_jobs.py @@ -72,7 +72,7 @@ trial_postgres_tests = [ { "python-version": "3.10", "database": "postgres", - "postgres-version": "13", + "postgres-version": "14", "extras": "all", }, { diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4f38ab0690..f320e89069 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -617,7 +617,7 @@ jobs: matrix: include: - python-version: "3.10" - postgres-version: "13" + postgres-version: "14" - python-version: "3.14" postgres-version: "17" diff --git a/changelog.d/19170.removal b/changelog.d/19170.removal new file mode 100644 index 0000000000..2e43b3e987 --- /dev/null +++ b/changelog.d/19170.removal @@ -0,0 +1 @@ +Remove support for PostgreSQL 13. diff --git a/docker/complement/Dockerfile b/docker/complement/Dockerfile index 8766f14454..ec4bca232c 100644 --- a/docker/complement/Dockerfile +++ b/docker/complement/Dockerfile @@ -11,7 +11,7 @@ ARG SYNAPSE_VERSION=latest ARG FROM=matrixdotorg/synapse-workers:$SYNAPSE_VERSION ARG DEBIAN_VERSION=trixie -FROM docker.io/library/postgres:13-${DEBIAN_VERSION} AS postgres_base +FROM docker.io/library/postgres:14-${DEBIAN_VERSION} AS postgres_base FROM $FROM # First of all, we copy postgres server from the official postgres image, @@ -26,7 +26,7 @@ RUN adduser --system --uid 999 postgres --home /var/lib/postgresql COPY --from=postgres_base /usr/lib/postgresql /usr/lib/postgresql COPY --from=postgres_base /usr/share/postgresql /usr/share/postgresql COPY --from=postgres_base --chown=postgres /var/run/postgresql /var/run/postgresql -ENV PATH="${PATH}:/usr/lib/postgresql/13/bin" +ENV PATH="${PATH}:/usr/lib/postgresql/14/bin" ENV PGDATA=/var/lib/postgresql/data # We also initialize the database at build time, rather than runtime, so that it's faster to spin up the image. diff --git a/docs/upgrade.md b/docs/upgrade.md index b3121a01a0..20b7e952b2 100644 --- a/docs/upgrade.md +++ b/docs/upgrade.md @@ -117,6 +117,14 @@ each upgrade are complete before moving on to the next upgrade, to avoid stacking them up. You can monitor the currently running background updates with [the Admin API](usage/administration/admin_api/background_updates.html#status). +# Upgrading to v1.143.0 + +## Dropping support for PostgreSQL 13 + +In line with our [deprecation policy](deprecation_policy.md), we've dropped +support for PostgreSQL 13, as it is no longer supported upstream. +This release of Synapse requires PostgreSQL 14+. + # Upgrading to v1.142.0 ## Python 3.10+ is now required diff --git a/synapse/storage/engines/postgres.py b/synapse/storage/engines/postgres.py index cc7e5508fd..03ecff27f0 100644 --- a/synapse/storage/engines/postgres.py +++ b/synapse/storage/engines/postgres.py @@ -99,8 +99,8 @@ class PostgresEngine( allow_unsafe_locale = self.config.get("allow_unsafe_locale", False) # Are we on a supported PostgreSQL version? - if not allow_outdated_version and self._version < 130000: - raise RuntimeError("Synapse requires PostgreSQL 13 or above.") + if not allow_outdated_version and self._version < 140000: + raise RuntimeError("Synapse requires PostgreSQL 14 or above.") with db_conn.cursor() as txn: txn.execute("SHOW SERVER_ENCODING")