summaryrefslogtreecommitdiffstats
path: root/server/catversion
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 13:35:12 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 13:35:12 +0000
commit53b8d04ebc10d070b7efafd6dfa9de2897916888 (patch)
treee95cc322bcaf0990808f10f0fdcb508014e7e496 /server/catversion
parentInitial commit. (diff)
downloadpostgresql-common-53b8d04ebc10d070b7efafd6dfa9de2897916888.tar.xz
postgresql-common-53b8d04ebc10d070b7efafd6dfa9de2897916888.zip
Adding upstream version 258.upstream/258
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xserver/catversion17
1 files changed, 17 insertions, 0 deletions
diff --git a/server/catversion b/server/catversion
new file mode 100755
index 0000000..fc4af08
--- /dev/null
+++ b/server/catversion
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# Extract server catalog and control file version numbers.
+# This information is stored in the packages and used at install time to
+# determine if an in-major-version pg_upgradecluster is required.
+
+set -eu
+
+CATVERSION=$(awk '/^#define CATALOG_VERSION_NO/ { print $3 }' src/include/catalog/catversion.h)
+CONTROLVERSION=$(awk '/^#define PG_CONTROL_VERSION/ { print $3 }' src/include/catalog/pg_control.h)
+
+case $CONTROLVERSION in
+ # control file versions used in PG 9.6 .. 15
+ # don't append to catversion to avoid spurious warnings for users of existing packages
+ 960|1002|1100|1201|1300) echo "$CATVERSION" ;;
+ *) echo "$CATVERSION-$CONTROLVERSION" ;;
+esac