Skip to content

Commit 4abedc3

Browse files
committed
Added more strict check for catalog versions which can be upgraded to current one. Explicit list of such versions is hardcoded into script
1 parent 3f62e63 commit 4abedc3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/pgpro-upgrade/pgpro_upgrade

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ esac
3232
# Check the catalog version
3333
CATALOG_VERSION_NO=2016081311
3434
MAJORVER=9.6
35+
# catalog version upgrade supported from. Space-separated list
36+
UPGRADABLE_CATVER="201608131"
3537
if [ ! -f "${PGDATA}/global/pg_control" -a -f "${PGDATA}/postgresql.conf" ]; then
3638
# looks like we have Debian with separate directory for configs
3739
SAVE_PGDATA="$PGDATA"
@@ -45,6 +47,17 @@ if [ ! -f "${PGDATA}/global/pg_control" -a -f "${PGDATA}/postgresql.conf" ]; the
4547
fi
4648
CATVER=`${PGBIN}pg_controldata|sed -n '/Catalog version number:/s/^.*: *//p'`
4749
if [ "$CATVER" != $CATALOG_VERSION_NO ]; then
50+
for v in $UPGRADABLE_CATVER; do
51+
if [ "$CATVER" = "$v" ]; then
52+
upgrade_possible=1
53+
break
54+
fi
55+
done
56+
if [ -z "$upgrade_possible" ]; then
57+
echo "Upgrade of $PGDATA from catalog version '$CATVER' is not supported" >&2
58+
exit 2
59+
fi
60+
4861
if [ -n "$check" ]; then
4962
echo "Database needs upgrade"
5063
exit 1

0 commit comments

Comments
 (0)