postgresql/src
Tom Lane 6b48f06da8 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
..
backend Allow NumericOnly to be "+ FCONST". 2017-05-29 15:19:07 -04:00
bin Prevent running pg_resetwal/pg_resetxlog against wrong-version data dirs. 2017-05-29 17:08:16 -04:00
include Stamp 9.2.21. 2017-05-08 17:22:52 -04:00
interfaces Stamp 9.2.21. 2017-05-08 17:22:52 -04:00
makefiles Don't use deprecated dllwrap on Cygwin. 2014-02-01 16:13:46 -05:00
pl Translation updates 2017-05-08 10:20:30 -04:00
port Stamp 9.2.21. 2017-05-08 17:22:52 -04:00
template AIX: Test the -qlonglong option before use. 2015-07-17 03:02:18 -04:00
test Move autogenerated array types out of the way during ALTER ... RENAME. 2017-05-26 15:16:59 -04:00
timezone Fix new warnings from GCC 7 2017-05-15 13:31:35 -04:00
tools Update URLs in pgindent source and README 2017-05-23 14:04:53 -04:00
tutorial Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
bcc32.mak Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Fix some oversights in distprep and maintainer-clean targets. 2011-03-10 00:04:05 -05:00
Makefile.global.in Document usage of COPT environment variable for adjusting configure flags. 2017-02-17 16:11:03 -05:00
Makefile.shlib Fix typos in comments. 2017-02-06 11:34:32 +02:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00
win32.mak Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00