LP#1730721: future proof build-db.sh
authorBen Shum <ben@evergreener.net>
Tue, 7 Nov 2017 18:41:56 +0000 (13:41 -0500)
committerJason Stephenson <jason@sigio.com>
Tue, 7 Nov 2017 18:47:42 +0000 (13:47 -0500)
Use the same logic we've got in eg_db_config for build-db.sh to determine
PostgreSQL version installed on server.

Signed-off-by: Ben Shum <ben@evergreener.net>
Signed-off-by: Jason Stephenson <jason@sigio.com>

Open-ILS/src/sql/Pg/build-db.sh

index 2b3540c..4eb7be0 100755 (executable)
@@ -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 -c1,3`
+DB_VERSION=`psql -qtc 'show server_version;' | xargs | cut -d. -f 1,2 | tr -d '.'`
 if [ -z "$DB_VERSION" ] || [ `echo $DB_VERSION | grep -c '[^0-9]'` != 0 ]; then
   cat <<EOM
 ********************************************************************************