]> granicus.if.org Git - postgresql/commitdiff
pg_upgrade: improve checksum mismatch error message
authorBruce Momjian <bruce@momjian.us>
Thu, 12 Feb 2015 03:22:26 +0000 (22:22 -0500)
committerBruce Momjian <bruce@momjian.us>
Thu, 12 Feb 2015 03:22:26 +0000 (22:22 -0500)
Patch by Greg Sabino Mullane, slight adjustments by me

contrib/pg_upgrade/controldata.c

index a02a8ecaa2391ac31a76eb2bc478ea149ff98cb8..0e70b6f80b484e4e4535c025d3e997f76d4bfd4e 100644 (file)
@@ -572,10 +572,14 @@ check_control_data(ControlData *oldctrl,
         * We might eventually allow upgrades from checksum to no-checksum
         * clusters.
         */
-       if (oldctrl->data_checksum_version != newctrl->data_checksum_version)
-       {
-               pg_fatal("old and new pg_controldata checksum versions are invalid or do not match\n");
-       }
+       if (oldctrl->data_checksum_version == 0 &&
+               newctrl->data_checksum_version != 0)
+               pg_fatal("old cluster does not use data checksums but the new one does\n");
+       else if (oldctrl->data_checksum_version != 0 &&
+                        newctrl->data_checksum_version == 0)
+               pg_fatal("old cluster uses data checksums but the new one does not\n");
+       else if (oldctrl->data_checksum_version != newctrl->data_checksum_version)
+               pg_fatal("old and new cluster pg_controldata checksum versions do not match\n");
 }