Bug 2411778

Summary: postgresql-upgrade fails for F42==>F43 because it only ships N−1 (17) while system was on 16
Product: [Fedora] Fedora Reporter: Gerald Cox <gbcox>
Component: postgresql18Assignee: Filip Januš <fjanus>
Status: NEW --- QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: 43CC: anezbeda, emmanuel, fjanus, fweimer, kevin, ndavidov
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: commonbugs
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Gerald Cox 2025-11-01 19:03:16 UTC
Summary

Fedora 43 jumped system PostgreSQL from 16 ==> 18, but postgresql-upgrade only provides the previous major (17) under /usr/lib64/pgsql/postgresql-17. Users on 16 cannot run pg_upgrade because the required 16 binaries are absent. This forces workarounds (manual RPM extraction or container dump/restore) on a distro-driven major upgrade.

Actual behavior

F42 ships PG16; upgrade to F43 removes PG16.

This makes pg_upgrade -b /usr/lib64/pgsql/postgresql-16/bin -B /usr/bin … function again without forcing users into dump/restore.

dnf install postgresql-upgrade on F43 provides only /usr/lib64/pgsql/postgresql-17.

Running pg_upgrade 16→18 fails due to missing 16 toolchain (and checksum/locale mismatches compound confusion).

Expected behavior

When Fedora skips a major (N=>N+2), users must still have a first-class, supported path to pg_upgrade.

Proposed fix

When Fedora skips a PostgreSQL major (e.g. 16 => 18), postgresql-upgrade must include the older major’s binaries (here: 16) so that pg_upgrade continues to work.

i.e. for Fedora 43, postgresql-upgrade should provide:
/usr/lib64/pgsql/postgresql-16/


Reproducible: Always




Additional Information:
Fedora 42 ==> 43 upgrades that were on PostgreSQL 16 do not have the needed 16 binaries present in Fedora 43. Users can recreate them by:

1. sudo mkdir -p /usr/lib64/pgsql/postgresql-16
2. sudo mkdir -p /tmp/pg16rpms
3. sudo dnf5 download --releasever=42 --disablerepo='*' --enablerepo=fedora,updates --destdir /tmp/pg16rpms postgresql16 postgresql16-server postgresql-libs postgresql-private-libs --arch=x86_64
4. cd /usr/lib64/pgsql/postgresql-16
5. for f in /tmp/pg16rpms/*.rpm; do sudo rpm2cpio "$f" | sudo cpio -idmv; done
6. sudo rsync -a usr/ . && sudo rm -rf usr
7. /usr/lib64/pgsql/postgresql-16/bin/postgres --version

Comment 1 Kevin Fenzi 2025-11-05 18:47:50 UTC
Lots of folks are hitting this. ;( 

Adding commonbugs to whiteboard.

You should be able to work around things by something like:

% sudo dnf install postgresql17-server postgresql17-upgrade --allowerasing
(this will replace postgresql package that is version 18)
% sudo -u postgres postgresql-upgrade /var/lib/pgsql/data

If you then want to move on to 18:

% systemctl stop postgresql
% sudo -u postgres pg_checksums -D /var/lib/pgsql/data -e -P
(18 defaults to checksums on, you need to have them before you can upgrade)
% sudo dnf install postgresql-server postgresql-upgrade --allowerasing
% sudo -u postgres postgresql-upgrade /var/lib/pgsql/data

(untested, please backup your database before trying)

Comment 2 Filip Januš 2025-11-05 20:05:29 UTC
Yes, this is one option to migrate to 17 and then to 18. I will try to find a more suitable solution.

Comment 3 Gerald Cox 2025-11-05 20:50:59 UTC
https://tso.bzb.us/2025/11/postgresql-upgrade-fedora-42.html
The above link gives full instructions.

Comment 4 Florian Weimer 2025-11-12 09:12:57 UTC
(In reply to Kevin Fenzi from comment #1)
> % systemctl stop postgresql
> % sudo -u postgres pg_checksums -D /var/lib/pgsql/data -e -P
> (18 defaults to checksums on, you need to have them before you can upgrade)
> % sudo dnf install postgresql-server postgresql-upgrade --allowerasing
> % sudo -u postgres postgresql-upgrade /var/lib/pgsql/data

Something like this might better than enabling checksums, especially for large databases or if the file system already performs checksumming:

# PGSETUP_INITDB_OPTIONS=--no-data-checksums postgresql-setup --upgrade