Re: two issues with v12 beta3 - Mailing list pgsql-pkg-yum

From Justin Pryzby
Subject Re: two issues with v12 beta3
Date
Msg-id 20190822162121.GE15332@telsasoft.com
Whole thread Raw
In response to Re: two issues with v12 beta3  (Devrim Gündüz <devrim@gunduz.org>)
Responses Re: two issues with v12 beta3  (Justin Pryzby <pryzby@telsasoft.com>)
Re: two issues with v12 beta3  (Justin Pryzby <pryzby@telsasoft.com>)
List pgsql-pkg-yum
On Thu, Aug 22, 2019 at 05:52:34PM +0300, Devrim Gündüz wrote:
> 
> Hi Justin,
> 
> On Thu, 2019-08-22 at 07:46 -0500, Justin Pryzby wrote:
> > One of our customers is shutting down, so I took the opportunity to upgrade
> > their DB to v12b3.
> > 
> > I found 2 issues:
> > 
> > The initscript and refuses to start for beta versions.
> > > [pryzbyj@telsasoft ~]$ sudo /etc/init.d/postgresql-12 start
> > > 
> > > An old version of the database format was found.
> > > You need to upgrade the data format before using PostgreSQL.
> > > See (Your System's documentation directory)/postgresql-12beta2/README.rpm-
> > > dist for more information.
> > 
> > Due to:
> > ++ cat /var/lib/pgsql/12/data/PG_VERSION
> > + '[' x12 '!=' x12beta2 ']'
> > 
> > # PGMAJORVERSION is major version, e.g., 10 (this should match PG_VERSION)
> > PGMAJORVERSION=`echo "$PGVERSION" | sed 's/^\([0-9]*\)\.[0-9]*$/\1/'`
> > 
> > I guess it should s/beta[0-9]*$//, or (I suggested in the past):
> > PGMAJORVERSION=${PGVERSION%%.*}
> 
> Fixed. Thanks for the report. 

I think the patch is wrong.
It used to do: -PGMAJORVERSION=`echo "$PGVERSION" | sed 's/^\([0-9]*\)\.[0-9]*$/\1/'`
meaning: remove trailing .* suffix.  That's still necessary (well it will be in
November when 12.1 is scheduled to be released).  Need to ALSO remove betaN.
https://git.postgresql.org/gitweb/?p=pgrpms.git;a=commitdiff;h=1f870b1071c1c35793796220522e6c9929692e85

I proposed: PGMAJORVERSION=${PGVERSION%%.*}
meaning: remove maximum suffix matching .* (literal dot, not a shell metachar)
... without forking and relying on sed.
It's my understanding that's portable POSIX shell.

And, you could do:
PGPREVMAJORVERSION=$((PGMAJORVERSION-1))

> > Also, for centos6, v12b2 is available but not 12b3??
> 
> *sigh* .  It was an issue with CentOS 6 sync scripts. Sorry.
> 
> So, I used this chance to rebuild beta3 with the fix above. They will be
> available in next 30 mins.

Not yet, but I'm in no rush.  It looks like I really did install the previous
betas (at least v3 on centos7) but apparently never restarted, since the
catalog version was changed and I never noticed that nor the initscript.

Justin



pgsql-pkg-yum by date:

Previous
From: Devrim Gündüz
Date:
Subject: Re: two issues with v12 beta3
Next
From: Justin Pryzby
Date:
Subject: Re: two issues with v12 beta3