DAT-58Required
Upgrade the database before its support ends
Run every database on a major version that still gets security fixes. Move to a new major version before the old one reaches its end-of-life date.
How to do it
PostgreSQL supports each major version for 5 years, then ships a final minor release. PostgreSQL 13 lost support on 13 November 2025, and PostgreSQL 14 loses it on 12 November 2026. Minor releases never change the storage format, so they need only new binaries and a restart. Install them in the time Keep software current and quiet sets. A major upgrade changes the format. Use pg_upgrade for minutes of downtime, or logical replication to a new server for seconds. Read the Migration section of the release notes of every version you skip. Rehearse the upgrade on a copy first, as Test migrations on a copy of production data says. Run the tests on the new version, as Test against the same database engine says. A managed database still needs you to schedule the major upgrade. For how much support to leave when you pick a version, see Use PostgreSQL for the main database.
Examples
SQL example
-- PostgreSQL and MySQL both answer this
SELECT version();
-- PostgreSQL, as a number such as 180006 for 18.6
SHOW server_version_num;
Shell example
# Rehearse a major upgrade on a restored copy, with hard links for speed
pg_upgrade --old-datadir /srv/pg17/data --new-datadir /srv/pg18/data \
--old-bindir /usr/lib/postgresql/17/bin --new-bindir /usr/lib/postgresql/18/bin --link --check
How to check
The version query on every environment returns a major version whose end-of-life date on the vendor's versioning page is after today.
Sources
Related rules
- Keep software current and quiet in Security testing
- Test migrations on a copy of production data in Data
- Test against the same database engine in Testing
- Use PostgreSQL for the main database in Software choices
- Upgrade managed engines before standard support ends in Infrastructure
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/data/operations/supported-versions">Agent Wranglers data playbook</a>. In code you write, add a comment next to it with the same link.