From: Ben Shum Date: Tue, 7 Nov 2017 20:09:47 +0000 (-0500) Subject: LP#1730721: future proof build-db.sh (followup) X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=73a18745da1e0a6340e84233d57f4bb42ec66d37;p=evergreen%2Fequinox.git LP#1730721: future proof build-db.sh (followup) For PostgreSQL 10+, the versioning scheme has changed. We only want the top number for those versions and up. So, grab only the first two numbers for the variable... 9.6.5 = 96 10.0 = 10, etc. Signed-off-by: Ben Shum Signed-off-by: Jason Stephenson --- diff --git a/Open-ILS/src/sql/Pg/build-db.sh b/Open-ILS/src/sql/Pg/build-db.sh index 4eb7be0eae..4b8df82912 100755 --- a/Open-ILS/src/sql/Pg/build-db.sh +++ b/Open-ILS/src/sql/Pg/build-db.sh @@ -15,7 +15,7 @@ export PGHOST PGPORT PGDATABASE PGUSER PGPASSWORD # --------------------------------------------------------------------------- # Lookup the database version from the PostgreSQL server. # --------------------------------------------------------------------------- -DB_VERSION=`psql -qtc 'show server_version;' | xargs | cut -d. -f 1,2 | tr -d '.'` +DB_VERSION=`psql -qtc 'show server_version;' | xargs | cut -d. -f 1,2 | tr -d '.' | cut -c1,2` if [ -z "$DB_VERSION" ] || [ `echo $DB_VERSION | grep -c '[^0-9]'` != 0 ]; then cat <