Re: libpq environment variables in the server

From: Noah Misch <noah(at)leadboat(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: libpq environment variables in the server
Date: 2019-03-15 04:00:53
Message-ID: 20190315040053.GB2607362@rfd.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2019-03-15 04:04:02 string_to_array, array_to_string function without separator
Previous Message Kyotaro HORIGUCHI 2019-03-15 03:54:52 Re: Index Skip Scan