postgresql/src/bin
Tom Lane f3db7f164a Prevent running pg_resetwal/pg_resetxlog against wrong-version data dirs.
pg_resetwal (formerly pg_resetxlog) doesn't insist on finding a matching
version number in pg_control, and that seems like an important thing to
preserve since recovering from corrupt pg_control is a prime reason to
need to run it.  However, that means you can try to run it against a
data directory of a different major version, which is at best useless
and at worst disastrous.  So as to provide some protection against that
type of pilot error, inspect PG_VERSION at startup and refuse to do
anything if it doesn't match.  PG_VERSION is read-only after initdb,
so it's unlikely to get corrupted, and even if it were corrupted it would
be easy to fix by hand.

This hazard has been there all along, so back-patch to all supported
branches.

Michael Paquier, with some kibitzing by me

Discussion: https://postgr.es/m/f4b8eb91-b934-8a0d-b3cc-68f06e2279d1@enterprisedb.com
2017-05-29 17:08:16 -04:00
..
initdb Post-PG 10 beta1 pgperltidy run 2017-05-17 19:01:23 -04:00
pg_archivecleanup Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
pg_basebackup Post-PG 10 beta1 pgperltidy run 2017-05-17 19:01:23 -04:00
pg_config Translation updates 2017-05-15 12:19:54 -04:00
pg_controldata Translation updates 2017-05-15 12:19:54 -04:00
pg_ctl Post-PG 10 beta1 pgperltidy run 2017-05-17 19:01:23 -04:00
pg_dump Fix typo in pg_dump's support for dumping collations from pre-v10 servers. 2017-05-26 15:37:06 -04:00
pg_resetwal Prevent running pg_resetwal/pg_resetxlog against wrong-version data dirs. 2017-05-29 17:08:16 -04:00
pg_rewind Translation updates 2017-05-15 12:19:54 -04:00
pg_test_fsync Translation updates 2017-05-15 12:19:54 -04:00
pg_test_timing Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
pg_upgrade pg_upgrade: Handle hash index upgrades more smoothly. 2017-05-19 16:49:38 -04:00
pg_waldump Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
pgbench Fix pgbench's --progress-timestamp option to print Unix-epoch timestamps. 2017-04-11 08:59:40 -04:00
pgevent Remove useless duplicate inclusions of system header files. 2017-02-25 16:12:55 -05:00
psql Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
scripts Post-PG 10 beta1 pgperltidy run 2017-05-17 19:01:23 -04:00
Makefile Rename user-facing tools with "xlog" in the name to say "wal". 2017-02-09 16:23:46 -05:00