From 3f6504034c95292fba9ae721c857f71a23d1598c Mon Sep 17 00:00:00 2001 From: Daniel Gustafsson Date: Mon, 7 Sep 2026 12:22:01 +0200 Subject: [PATCH v16 7/9] 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 759bd4ef77c..e83f2d963cd 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)