Re: pg_upgrade and PGPORT

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_upgrade and PGPORT
Date: 2011-05-16 14:50:41
Message-ID: 201105161450.p4GEofR12216@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian wrote:
> Bruce Momjian wrote:
> > > >> ? ? ? Performing Consistency Checks
> > > >> ? ? ? -----------------------------
> > > >> ? ? ? ignoring libpq environment variable PGPORT
> > > >
> > > > I haven't tried it, but I suppose option.c will now make use of PGPORT
> > > > and then later you get that message that it was ignored?
> > >
> > > Either way, it hardly seems necessary to emit a log message stating
> > > that you are unsetting an environment variable.
> >
> > I think the whole idea of worrying about libpq environment variables is
> > useless. I looked at the list of libpq environment variables and I saw
> > a lot of useful ones, like PGUSER and PGPASSFILE, which we currently
> > throw an error.
> >
> > I propose we only disable the use of PGHOST and even then that prevents
> > users from controlling tcp vs. unix domain connections.
>
> OK, it turns out the environment variable handling in pg_upgrade was
> worse than I thought. This patch:
>
> o disables only PGHOST and only if it is set to a non-local value;
> all other environment variables are honored; PGDATA isn't even seen
> by libpq
> o push --user value into the PGUSER environment variable so pg_ctl -w
> uses it; pg_ctl has no --user flag; this is important for pre-9.1
> pg_ctl binaries
> o move putenv() function to utils.c now that it is used by option.c
> o allow pg_ctl failure to continue with a connection request to get a
> possible error message, then exit
> o update document to be clearer and mention environment variables
>
> Patch attached.

I have applied the updated attached patch which allows pg_upgrade to
honor environment variable. This updated version is clearer about
handling of PGHOST, and adds PGHOSTADDR checks.

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

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

Attachment Content-Type Size
/rtmp/pg_upgrade text/x-diff 19.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nick Raj 2011-05-16 14:57:21 Re: DETOAST Datum
Previous Message Tom Lane 2011-05-16 14:26:05 Re: Extensions in schemas