Re: libpq environment variables in the server
Noah Misch <noah@leadboat.com>
From: Noah Misch <noah@leadboat.com>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2019-03-15T04:00:53Z
Lists: pgsql-hackers
Looks good.
On Thu, Mar 14, 2019 at 12:06:45PM +0100, Peter Eisentraut wrote:
> + # Temporarily unset PGAPPNAME so that the server doesn't inherit
> + # it. Otherwise this could affect libpqwalreceiver connections in
> + # confusing ways.
> + my $save_pgappname = $ENV{PGAPPNAME};
> + delete $ENV{PGAPPNAME};
> +
> # Note: We set the cluster_name here, not in postgresql.conf (in
> # sub init) so that it does not get copied to standbys.
> my $ret = TestLib::system_log('pg_ctl', '-D', $self->data_dir, '-l',
> $self->logfile, '-o', "--cluster-name=$name", 'start');
>
> + $ENV{PGAPPNAME} = $save_pgappname;
> +
I consider the following style more idiomatic:
{
local %ENV;
delete $ENV{PGAPPNAME};
...
}
I'm okay with the way you've written it, though.
Commits
-
Don't propagate PGAPPNAME through pg_ctl in tests
- 8e93a516e68b 12.0 landed