---
title: "Upgrade the database before its support · Agent Wranglers"
url: https://agentwranglers.se/playbook/data/operations/supported-versions
updated: 2026-10-21
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Upgrade the database before its support ends

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Operations](https://agentwranglers.se/playbook/data/operations.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers). Updated 2026-10-21.

- ID: DAT-58
- Level: Required
- Chapter: [Operations](https://agentwranglers.se/playbook/data/operations)
- Rule: 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.
- Risk: Data leaked or lost
- How: 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](https://agentwranglers.se/playbook/adversarial-testing/supply-chain-and-setup/patch-and-hide-versions) 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](https://agentwranglers.se/playbook/data/migrations/test-migrations) says. Run the tests on the new version, as [Test against the same database engine](https://agentwranglers.se/playbook/testing/integration-and-contract-tests/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](https://agentwranglers.se/playbook/stack/databases-and-storage/postgresql).
- 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.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### SQL example

```sql
-- PostgreSQL and MySQL both answer this
SELECT version();
-- PostgreSQL, as a number such as 180006 for 18.6
SHOW server_version_num;
```

### Shell example

```sh
# 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
```

## Sources

- [PostgreSQL versioning policy](https://www.postgresql.org/support/versioning/)
- [PostgreSQL upgrading a cluster](https://www.postgresql.org/docs/current/upgrading.html)

## Related rules

- [Keep software current and quiet](https://agentwranglers.se/playbook/adversarial-testing/supply-chain-and-setup/patch-and-hide-versions) in Security testing
- [Test migrations on a copy of production data](https://agentwranglers.se/playbook/data/migrations/test-migrations) in Data
- [Test against the same database engine](https://agentwranglers.se/playbook/testing/integration-and-contract-tests/same-database-engine) in Testing
- [Use PostgreSQL for the main database](https://agentwranglers.se/playbook/stack/databases-and-storage/postgresql) in Software choices
- [Upgrade managed engines before standard support ends](https://agentwranglers.se/playbook/infrastructure/cost-and-ownership/managed-engine-support) in Infrastructure

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/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.

- Previous: [Rebuild text indexes when the collation library changes](https://agentwranglers.se/playbook/data/operations/collation-versions)
- Next: [Turn off database features that reach the server](https://agentwranglers.se/playbook/data/operations/server-file-access)
- [Operations](https://agentwranglers.se/playbook/data/operations)
