If you run pg_controldata on a cluster that has been initialized with different PG_CONTROL_VERSION than what the pg_controldata program has been compiled with, pg_controldata will still try to interpret the control file, but the result is likely to be somewhat nonsensical. How nonsensical it is depends on the differences between the versions. If sizeof(ControlFileData) differs between the versions, the CRC will not match and you get a warning of that, but otherwise you get no warning. Looking back at recent PG_CONTROL_VERSION updates, all changes that would mess up the printed values have also changed sizeof(ControlFileData), but there's no guarantee of that in future versions. Add an explicit check and warning for version number mismatch before the CRC check. That way, you get a more clear warning if you use the pg_controldata binary from wrong version, and if we change the control file in the future in a way that doesn't change sizeof(ControlFileData), this ensures that you get a warning in that case too. Discussion: https://www.postgresql.org/message-id/2afded89-f9f0-4191-84d8-8b8668e029a1@iki.fi
PostgreSQL Database Management System
This directory contains the source code distribution of the PostgreSQL database management system.
PostgreSQL is an advanced object-relational database management system that supports an extended subset of the SQL standard, including transactions, foreign keys, subqueries, triggers, user-defined types and functions. This distribution also contains C language bindings.
Copyright and license information can be found in the file COPYRIGHT.
General documentation about this version of PostgreSQL can be found at https://www.postgresql.org/docs/devel/. In particular, information about building PostgreSQL from the source code can be found at https://www.postgresql.org/docs/devel/installation.html.
The latest version of this software, and related software, may be obtained at https://www.postgresql.org/download/. For more information look at our web site located at https://www.postgresql.org/.