Skip to content

Commit f9a89f0

Browse files
authored
Update PG_OLD_VERSION command for Postgres 10
1. We can have one or two digits in the major version. 2. The minor version is optional.
1 parent 4bcb247 commit f9a89f0

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

runtime/functions

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/bin/bash
22
set -e
3+
shopt -s extglob
34
source ${PG_APP_HOME}/env-defaults
45

56
PG_CONF=${PG_DATADIR}/postgresql.conf
@@ -185,7 +186,7 @@ initialize_database() {
185186
;;
186187
*)
187188
echo "Initializing database..."
188-
PG_OLD_VERSION=$(find ${PG_HOME}/[0-9].[0-9]/main -maxdepth 1 -name PG_VERSION 2>/dev/null | grep -v $PG_VERSION | sort -r | head -n1 | cut -d'/' -f5)
189+
PG_OLD_VERSION=$(find ${PG_HOME}/+([0-9])?(.[0-9])/main -maxdepth 1 -name PG_VERSION 2>/dev/null | grep -v $PG_VERSION | sort -r | head -n1 | cut -d'/' -f5)
189190
if [[ -n ${PG_OLD_VERSION} ]]; then
190191
echo "‣ Migrating PostgreSQL ${PG_OLD_VERSION} data to ${PG_VERSION}..."
191192

0 commit comments

Comments
 (0)