From 9ed68f64114e357f958cd80ba574413b097a2c12 Mon Sep 17 00:00:00 2001
From: Tom Lane
Date: Mon, 29 May 2017 17:08:16 -0400
Subject: 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
---
doc/src/sgml/ref/pg_resetxlog.sgml | 5 +++++
1 file changed, 5 insertions(+)
(limited to 'doc/src')
diff --git a/doc/src/sgml/ref/pg_resetxlog.sgml b/doc/src/sgml/ref/pg_resetxlog.sgml
index 34b06069556..a336503fa8b 100644
--- a/doc/src/sgml/ref/pg_resetxlog.sgml
+++ b/doc/src/sgml/ref/pg_resetxlog.sgml
@@ -204,6 +204,11 @@ PostgreSQL documentation
pg_resetxlog to run. But before you do
so, make doubly certain that there is no server process still alive.
+
+
+ pg_resetxlog works only with servers of the same
+ major version.
+
--
cgit v1.2.3