• PostgreSQL
  • databases
  • upgrades
  • operations

PostgreSQL 14 is end of life: rehearse the pg_upgrade before you run it

PostgreSQL 14.25, released November 12, 2026, was the last 14.x release. How to choose between PostgreSQL 18 and 19, rehearse a pg_upgrade on a copy, avoid the data-checksum mismatch that stops it, and verify the new cluster.

Suppose you look after a small application whose database has run on PostgreSQL 14 since 2022. Nothing is broken, and the server gets its monthly patches. That last part has now stopped: PostgreSQL 14.25, published on November 12, 2026, was the final release of the 14 line. From here on, a security bug found in PostgreSQL 14 will not be fixed in PostgreSQL 14. Release announcement

The way off an old major version is a major-version upgrade, and the usual tool is pg_upgrade. The tool is reliable, but it touches every file of your database, and one mode makes the old copy unusable. This article explains what “end of life” means here, how to choose the target version, and how to rehearse the whole upgrade on a throwaway copy before you touch production. Every command below was run on Ubuntu 24.04 with the PostgreSQL project’s own packages: 14.25 as the old version and 19.0 as the new one.

What end of life means for PostgreSQL

PostgreSQL has two kinds of releases. A major version (14, 15, … 19) can change the on-disk format of the system tables, so the data directory of one major version cannot simply be opened by the next. A minor release (14.24 → 14.25) only fixes bugs and security problems inside one major version; you install it by replacing the program files and restarting.

The project supports each major version for five years after its first release. After that it ships one final minor release, and the version becomes end of life (EOL): no more fixes of any kind. Versioning policy

As of December 3, 2026, the supported versions and their final dates are:

Version Latest minor Supported until
19 19.0 November 19, 2031
18 18.7 November 14, 2030
17 17.12 November 8, 2029
16 16.16 November 9, 2028
15 15.20 November 11, 2027
14 14.25 ended November 12, 2026

Your database does not stop working on that date. What changes is risk: the November 12 release alone fixed 52 security vulnerabilities across the supported versions, and the next batch will not reach 14.

Choosing a target version

You can jump straight from 14 to any newer version; pg_upgrade supports upgrades from 9.2 and later to the current release. pg_upgrade documentation There is no reason to stop at 15 or 16, which would only move the deadline closer. The real choice is between 18 and 19:

  • PostgreSQL 18 has been out since September 2025 and has had seven bug-fix releases. Pick it if you want the more settled line and are happy with support until November 2030.
  • PostgreSQL 19 was released on November 19, 2026 and is supported until November 2031. Pick it if you want the extra year and the new features, such as REPACK (CONCURRENTLY) for shrinking bloated tables, which an earlier article covers. A first release of a major version has had the least real-world use, so test your application against it carefully.

A simple decision rule: if you can test your application properly against the new version before the switch, 19 saves you one future upgrade. If you cannot, 18 is the more conservative choice. Both are supported for years.

Whichever you choose, read the “Migration to Version N” section of the release notes for every version you skip, because each one can contain behavior changes. Going from 14 to 19 means reading those sections for 15, 16, 17, 18 and 19. Two examples: PostgreSQL 18 made initdb enable data checksums by default, and PostgreSQL 19 removed RADIUS authentication (logins checked against an external RADIUS server), turned JIT compilation (compiling parts of a query to machine code while it runs) off by default, and now warns after a successful login with an MD5-hashed password; the warning can be turned off with md5_password_warnings. PostgreSQL 18 release notes PostgreSQL 19 release notes

How pg_upgrade works, in one paragraph

A cluster in PostgreSQL is one data directory served by one server process, holding one or more databases. pg_upgrade needs two clusters on the same machine: the old one (stopped) and a new, empty one created by the new version’s initdb. It dumps (exports as SQL) only the schema, meaning the definitions of tables, indexes and so on, from the old cluster, loads it into the new one, and then moves the actual data files across. The data files themselves are not rewritten, so with --link or --clone (below) the upgrade usually takes minutes even for large databases; the default --copy takes as long as copying all the data files.

How the files move depends on the mode:

  • --copy (the default) copies every file. Safe, but needs free disk space for a second full copy and is the slowest mode.
  • --link uses hard links: extra directory entries that point at the same file on disk, so both directories share the files. It is very fast and uses no extra space, but once you start the new server, the old cluster can no longer be used safely.
  • --clone makes copy-on-write copies, which share the data on disk until one side changes it, on file systems that support them (Btrfs and XFS with reflink on Linux, APFS on macOS): fast like --link while leaving the old cluster untouched.

--link and --clone both need the old and new data directories on the same file system. PostgreSQL 18 also added a --swap mode, which moves files and is described in the pg_upgrade documentation; this article sticks to the three modes above.

Rehearse the upgrade on a copy

The safest habit is to run the full upgrade on a copy of your data first, on a test machine or in a scratch directory. The steps below build a tiny practice cluster so you can see each message, then upgrade it. On a real system you would start from a restored backup instead of step 2.

1. Install the old and new binaries side by side. On Debian or Ubuntu, add the PostgreSQL project’s APT repository (apt.postgresql.org) and install both versions. The packages install into separate directories, /usr/lib/postgresql/14/bin and /usr/lib/postgresql/19/bin, so they do not conflict.

sudo apt-get install postgresql-14 postgresql-19

If your database uses an extension that is not part of the core packages, such as PostGIS, install that extension’s package for the new version too. pg_upgrade checks that every library the old cluster uses exists for the new one, and stops if one is missing.

2. Create a practice cluster with some data. Run these as the postgres operating-system user in an empty directory owned by that user, for example /srv/pgt. initdb creates a data directory, pg_ctl starts the server, and -k puts its socket (the local file clients connect through) in the current directory so it does not clash with other servers.

sudo install -d -o postgres /srv/pgt
sudo -iu postgres
cd /srv/pgt
B14=/usr/lib/postgresql/14/bin
$B14/initdb -D 14 -U postgres --data-checksums
$B14/pg_ctl -D 14 -o "-p 5414 -k $PWD" -l 14.log start
$B14/psql -h $PWD -p 5414 -U postgres -c "create database shop"
$B14/psql -h $PWD -p 5414 -U postgres -d shop -c "
  create extension pg_trgm;
  create table orders(id bigserial primary key, customer text, total numeric(10,2));
  insert into orders(customer, total) select 'c'||g, g%500 from generate_series(1,100000) g;
  create index on orders using gin (customer gin_trgm_ops);"
$B14/psql -h $PWD -p 5414 -U postgres -d shop -Atc "select count(*), sum(total) from orders"

The last command prints 100000|24950000.00. Write that down: you will compare it after the upgrade.

3. Check the old cluster’s settings. On your real server, run these in psql before planning anything:

SELECT version();
SHOW data_checksums;
SELECT extname, extversion FROM pg_extension;
SELECT datname, pg_encoding_to_char(encoding), datcollate, datctype FROM pg_database;

The last query lists each database’s encoding and locale, which the new cluster should match.

Data checksums are small check values that PostgreSQL stores in each data page so it can detect corruption. The setting matters because the old and new clusters must match, which leads to the most common surprise in this upgrade.

4. Stop the old server and create the new cluster.

$B14/pg_ctl -D 14 stop
B19=/usr/lib/postgresql/19/bin
$B19/initdb -D 19 -U postgres --data-checksums

Create the new cluster with the same encoding, locale and checksum setting as the old one. In this practice run both versions take the same operating-system locale defaults; on a real server, pass --encoding and --locale to initdb if the old cluster used something else.

5. Run the checks only. The --check option runs every compatibility test and changes nothing. -b/-B point at the old and new program directories, -d/-D at the old and new data directories, and -p/-P choose two ports.

$B19/pg_upgrade -b $B14 -B $B19 -d 14 -D 19 -p 5414 -P 5419 -U postgres --check

On the practice cluster, every line ends in ok, including a PostgreSQL 19-specific check named Checking for uses of gist_inet_ops/gist_cidr_ops, and the output ends with *Clusters are compatible*. If a check fails, the message says what to fix, and the old cluster is unchanged.

6. Run the upgrade. The same command without --check. Here we use --link because this is a practice copy; read the warning in the next section before using it in production.

$B19/pg_upgrade -b $B14 -B $B19 -d 14 -D 19 -p 5414 -P 5419 -U postgres --link

On the practice data this took about 2.5 seconds and ended with Upgrade Complete, plus two suggested vacuumdb commands and a script named delete_old_cluster.sh. Do not run that script yet.

The checksum mismatch, reproduced

Since PostgreSQL 18, initdb turns data checksums on by default. PostgreSQL 14 did not, so many old clusters have them off. If you create the new cluster with a plain initdb, the check stops early. You can reproduce it by leaving --data-checksums out of step 2’s initdb and running a plain initdb in step 4. This is what I got:

Checking cluster versions                                     ok

old cluster does not use data checksums but the new one does
Failure, exiting

The fix is to remove the new, still-empty cluster and recreate it with the option PostgreSQL 18 added for this case: PostgreSQL 18 release notes

$B19/initdb -D 19 -U postgres --no-data-checksums

After that, --check reported *Clusters are compatible*. You can turn checksums on later with the pg_checksums tool while the server is stopped, but that rewrites every data file, so plan it as a separate job.

Verify the new cluster

1. Start the new server and confirm the version and data.

$B19/pg_ctl -D 19 -o "-p 5419 -k $PWD" -l 19.log start
$B19/psql -h $PWD -p 5419 -U postgres -d shop -Atc "select version()"
$B19/psql -h $PWD -p 5419 -U postgres -d shop -Atc "select count(*), sum(total) from orders"
$B19/psql -h $PWD -p 5419 -U postgres -d shop -Atc "select extname, extversion from pg_extension"

Expected: a version string starting with PostgreSQL 19.0, the same 100000|24950000.00 as before, and pg_trgm|1.6. On your real data, compare row counts and a few business totals for your most important tables.

2. Check the optimizer statistics. The query planner uses statistics about each column, such as how many distinct values it has, to choose fast query plans. Before PostgreSQL 18, pg_upgrade threw them away, and queries could be slow until ANALYZE had run. Since 18, it transfers most of them. Extended statistics, statistics added by extensions and the activity counters (the cumulative statistics system) are not carried over. pg_upgrade documentation PostgreSQL 18 release notes I tested this in a separate practice cluster with a table whose text column held 50 distinct values: after ANALYZE on 14, pg_stats showed n_distinct = 50 for that column, and the same value was there on 19 straight after the upgrade. Then run the two commands that pg_upgrade prints:

$B19/vacuumdb -U postgres --all --analyze-in-stages --missing-stats-only
$B19/vacuumdb -U postgres --all --analyze-only

The first fills in statistics only for tables that have none; the second refreshes everything so autovacuum, the background process that cleans up old row versions and refreshes statistics, works from correct counts. (Add -h $PWD -p 5419 in the practice setup.)

3. Run your application’s tests against the new server, including the queries that matter most for speed.

Common mistakes

  • Starting the new cluster after --link and expecting to roll back. Once the new server has started, the old data directory is no longer safe to use; going back means restoring from a backup. If you have not started the new server yet, you can recover the old one by renaming global/pg_control.old back to global/pg_control. Use --copy or --clone if you want a quick way back.
  • No backup. Take a full backup before the real run and check that you can restore it.
  • Forgetting configuration. pg_upgrade moves data, not your postgresql.conf and pg_hba.conf settings. Re-apply your changes to the new cluster’s files, and review them against the new defaults.
  • Forgetting replicas. A standby server is a copy of the database that follows the main server for failover or read traffic. If you use --link, upgrade standbys with the rsync procedure in step 11 of the pg_upgrade documentation; otherwise, rebuild them from the new primary after it is running.
  • Skipping the release notes. A successful pg_upgrade only proves the data moved. Behavior changes, such as the removal of RADIUS authentication in 19, show up only when your application or users hit them.

On Debian and Ubuntu, the postgresql-common package also provides pg_upgradecluster, a wrapper that runs pg_upgrade and moves the configuration for clusters it manages. The steps above show what happens underneath, which helps when the wrapper reports an error.

Conclusion

PostgreSQL 14 stopped receiving fixes with 14.25 on November 12, 2026. Upgrade directly to 18 or 19: choose 19 if you can test thoroughly and want support until 2031, 18 if you prefer the more settled line. Rehearse on a copy, create the new cluster with the same checksum setting as the old one, run pg_upgrade --check until it reports compatible clusters, and verify row counts, extensions and statistics before you switch traffic. Keep a backup until the new server has been running well for a while.

Written by Duy Pham Independent developer. I build the apps on this site and write about how they work.

More about me