From 1bd208979345f830aa053b5e27afac8bff3d2807 Mon Sep 17 00:00:00 2001 From: Daniel Gustafsson Date: Mon, 7 Sep 2026 12:22:01 +0200 Subject: [PATCH v1 4/5] Improve error message for checksum state in pg_upgrade When attempting to upgrade a cluster which is an inprogress state, the same error message was used regardless of which state it was. Fix by using different error messages for the different inprogress states. Found by Noah using AI assisted review with Claude. Backpatch to v19 where the online checksums feature was introduced. Reported-by: Noah Misch Discussion: https://postgr.es/m/... Backpatch-through: 19 --- src/bin/pg_upgrade/controldata.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bin/pg_upgrade/controldata.c b/src/bin/pg_upgrade/controldata.c index 7543a988045..c985e917073 100644 --- a/src/bin/pg_upgrade/controldata.c +++ b/src/bin/pg_upgrade/controldata.c @@ -658,8 +658,10 @@ check_control_data(ControlData *oldctrl, * upgrade. The user should either let the process finish, or turn off * data checksums, before retrying. */ - if (oldctrl->data_checksum_version > PG_DATA_CHECKSUM_VERSION) + if (oldctrl->data_checksum_version == PG_DATA_CHECKSUM_INPROGRESS_ON) pg_fatal("data checksums are being enabled in the old cluster"); + if (oldctrl->data_checksum_version == PG_DATA_CHECKSUM_INPROGRESS_OFF) + pg_fatal("data checksums are being disabled in the old cluster"); /* * We might eventually allow upgrades from checksum to no-checksum -- 2.39.3 (Apple Git-146)