Skip to content

Commit afdee15

Browse files
committed
Merge branch 'PGPRO9_6' into PGPROEE9_6
2 parents 809314e + d5da254 commit afdee15

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/pgpro-upgrade/pgpro_upgrade

Lines changed: 14 additions & 1 deletion
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"
@@ -43,8 +45,19 @@ if [ ! -f "${PGDATA}/global/pg_control" -a -f "${PGDATA}/postgresql.conf" ]; the
4345
exit 1
4446
fi
4547
fi
46-
CATVER=`${PGBIN}pg_controldata|sed -n '/Catalog version number:/s/^.*: *//p'`
48+
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)