Re: pg_upgrade does not completely honor --new-port

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Devrim GÜNDÜZ <devrim(at)gunduz(dot)org>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_upgrade does not completely honor --new-port
Date: 2012-10-03 20:23:39
Message-ID: 20121003202339.GF3470@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Oct 3, 2012 at 05:16:55PM -0300, Alvaro Herrera wrote:
> Excerpts from Devrim GÜNDÜZ's message of mié oct 03 17:00:16 -0300 2012:
> >
> > Hi,
> >
> > On Wed, 2012-09-26 at 22:06 -0400, Bruce Momjian wrote:
> >
> > > > I just performed a test upgrade from 9.1 to 9.2, and used
> > > > --new-port variable. However, the analyze_new_cluster.sh does not
> > > > include the new port, thus when I run it, it fails. Any chance to
> > > > add the port number to the script?
> > >
> > > Well, the reason people normally use the port number is to do a live
> > > check, but obviously when the script is created it isn't doing a
> > > check. I am worried that if I do embed the port number in there, then
> > > if they change the port after the upgrade, they now can't use the
> > > script. I assume users would have PGPORT set before running the
> > > script, no?
> >
> > They can't use the script in each way -- at least we can make it usable
> > for one case, I think.
>
> Well, you could have the script set the port number only if the variable
> is not set from the calling shell ... you know,
> PGPORT=${PGPORT:=the_other_number} . That way, if the user wants to
> specify a different port, they have to set PGPORT before calling the
> script.

Good idea, but that is only going to work on Unix, and in fact only
using certain shells. I don't think we want to go there, do we? I
could expand that out to a normal shell _if_ statement, but again, only
works on Unix.

What we _could_ do is to add a comment line at the top that defines a
string that can be supplied, and default it to the port number; that
would work on Unix and Windows, e.g.

# uncomment and adjust if you want a special port number
# PGPORT_STR="-p 5435"
# export PGPORT

For Windows it would be "REM". Is everyone happy with that?

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2012-10-03 20:41:36 Re: Support for REINDEX CONCURRENTLY
Previous Message Bruce Momjian 2012-10-03 20:20:27 Re: pg_upgrade does not completely honor --new-port