future proof build-db.sh

Bug #1730721 reported by Ben Shum on 2017-11-07
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Wishlist
Unassigned

Bug Description

Evergreen master

In Open-ILS/src/sql/Pg/build-db.sh, we have this line to grab and select the database version:

DB_VERSION=`psql -qtc 'show server_version;' | xargs | cut -c1,3`

In most cases, this results in the first and third character being pulled into the version, like:

version = 9.5.9 becoming "95" as the result.

With the upcoming PostgreSQL 10, this comes back as:

version = 10.0 becoming "1." as the result.

Grabbing an idea from the comparison recently added in eg_db_config to test for higher postgresql versions, we should change the line to be like this:

DB_VERSION=`psql -qtc 'show server_version;' | xargs | cut -d. -f 1,2 | tr -d '.'`

This properly results in a DB_VERSION value like "100" with PostgreSQL 10.0

Patch forthcoming to future proof and fix build-db.sh script.

Ben Shum (bshum) wrote :
Changed in evergreen:
status: New → Confirmed
importance: Undecided → Wishlist
milestone: none → 3.next
tags: added: pull
tags: added: pullrequest
removed: pull
Jason Stephenson (jstephenson) wrote :

Works for me and a good catch!

Pushed to master for future use.

Changed in evergreen:
status: Confirmed → Fix Committed
Mike Rylander (mrylander) wrote :

Please note, from version 10 on, Postgres will be changing the way versions are numbered. The result is that we will only want to track the first component from here on out, rather than the first and second. Since there won't be a two digit component of the first two from <= 9.6, we can instead just start taking the first two numeric characters in the version string. Granted, we'll have to revisit when PG hits version 100, in about 90 years, but hopefully we'll all individually have figured out something better to do by then, with our flying cars and our moon bases.

Ben Shum (bshum) wrote :

Hmm, Mike's right, the versioning change for PostgreSQL 10+ will change how this behaves.

Follow patch on tip of same working branch.

Jason Stephenson (jstephenson) wrote :

Mike is definitely correct, I signed off and pushed the correction to use just the first two characters from the db version so that we have fewer create database scripts going forward.

Galen Charlton (gmc) on 2017-11-09
Changed in evergreen:
milestone: 3.next → 3.1-beta
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers