Hi all, Following up with the recent thread that dealt with the same $subject for the TAP tests, I have gone through pg_regress.c: https://www.postgresql.org/message-id/ylbjjrpuciez7...@paquier.xyz
The list of environment variables that had better be reset when using a temporary instance is very close to TestLib.pm, leading to the attached. Please note that that the list of unsetted parameters has been reorganized to be consistent with the TAP tests, and that I have added comments referring one and the other. Thoughts? -- Michael
diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm index 47d7f31e94..26fbe08d4b 100644 --- a/src/test/perl/TestLib.pm +++ b/src/test/perl/TestLib.pm @@ -104,6 +104,7 @@ BEGIN delete $ENV{LC_ALL}; $ENV{LC_MESSAGES} = 'C'; + # This list should be kept in sync with pg_regress.c. my @envkeys = qw ( PGCHANNELBINDING PGCLIENTENCODING diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c index e04d365258..89db370184 100644 --- a/src/test/regress/pg_regress.c +++ b/src/test/regress/pg_regress.c @@ -819,14 +819,33 @@ initialize_environment(void) * we also use psql's -X switch consistently, so that ~/.psqlrc files * won't mess things up.) Also, set PGPORT to the temp port, and set * PGHOST depending on whether we are using TCP or Unix sockets. + * + * This list should be kept in sync with TestLib.pm. */ - unsetenv("PGDATABASE"); - unsetenv("PGUSER"); - unsetenv("PGSERVICE"); - unsetenv("PGSSLMODE"); - unsetenv("PGREQUIRESSL"); + unsetenv("PGCHANNELBINDING"); unsetenv("PGCONNECT_TIMEOUT"); unsetenv("PGDATA"); + unsetenv("PGDATABASE"); + unsetenv("PGGSSENCMODE"); + unsetenv("PGGSSLIB"); + unsetenv("PGKRBSRVNAME"); + unsetenv("PGPASSFILE"); + unsetenv("PGREQUIREPEER"); + unsetenv("PGREQUIRESSL"); + unsetenv("PGSERVICE"); + unsetenv("PGSERVICEFILE"); + unsetenv("PGSSLCERT"); + unsetenv("PGSSLCRL"); + unsetenv("PGSSLCRLDIR"); + unsetenv("PGSSLKEY"); + unsetenv("PGSSLMAXPROTOCOLVERSION"); + unsetenv("PGSSLMINPROTOCOLVERSION"); + unsetenv("PGSSLMODE"); + unsetenv("PGSSLROOTCERT"); + unsetenv("PGSSLSNI"); + unsetenv("PGTARGETSESSIONATTRS"); + unsetenv("PGUSER"); + #ifdef HAVE_UNIX_SOCKETS if (hostname != NULL) setenv("PGHOST", hostname, 1);
signature.asc
Description: PGP signature