Skip to content

Commit 15cb0bf

Browse files
committed
Ignore more environment variables in pg_regress.c
This is similar to the work done in 8279f68 for TestLib.pm, where environment variables set may cause unwanted failures if using a temporary installation with pg_regress. The list of variables reset is adjusted in each stable branch depending on what is supported. Comments are added to remember that the lists in TestLib.pm and pg_regress.c had better be kept in sync. Reviewed-by: Álvaro Herrera Discussion: https://postgr.es/m/YMNR9GYDn+fHlMta@paquier.xyz Backpatch-through: 9.6
1 parent b170ca0 commit 15cb0bf

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

src/test/perl/TestLib.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ BEGIN
6262
delete $ENV{LC_ALL};
6363
$ENV{LC_MESSAGES} = 'C';
6464

65+
# This list should be kept in sync with pg_regress.c.
6566
my @envkeys = qw (
6667
PGCLIENTENCODING
6768
PGCONNECT_TIMEOUT

src/test/regress/pg_regress.c

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -800,14 +800,32 @@ initialize_environment(void)
800800
* we also use psql's -X switch consistently, so that ~/.psqlrc files
801801
* won't mess things up.) Also, set PGPORT to the temp port, and set
802802
* PGHOST depending on whether we are using TCP or Unix sockets.
803+
*
804+
* This list should be kept in sync with TestLib.pm.
803805
*/
806+
/* PGCLIENTENCODING, see above */
807+
unsetenv("PGCONNECT_TIMEOUT");
808+
unsetenv("PGDATA");
804809
unsetenv("PGDATABASE");
805-
unsetenv("PGUSER");
810+
unsetenv("PGGSSLIB");
811+
/* PGHOSTADDR, see below */
812+
unsetenv("PGKRBSRVNAME");
813+
unsetenv("PGPASSFILE");
814+
unsetenv("PGPASSWORD");
815+
unsetenv("PGREQUIREPEER");
816+
unsetenv("PGREQUIRESSL");
806817
unsetenv("PGSERVICE");
818+
unsetenv("PGSERVICEFILE");
819+
unsetenv("PGSSLCERT");
820+
unsetenv("PGSSLCRL");
821+
unsetenv("PGSSLKEY");
807822
unsetenv("PGSSLMODE");
808-
unsetenv("PGREQUIRESSL");
809-
unsetenv("PGCONNECT_TIMEOUT");
810-
unsetenv("PGDATA");
823+
unsetenv("PGSSLROOTCERT");
824+
unsetenv("PGTARGETSESSIONATTRS");
825+
unsetenv("PGUSER");
826+
/* PGPORT, see below */
827+
/* PGHOST, see below */
828+
811829
#ifdef HAVE_UNIX_SOCKETS
812830
if (hostname != NULL)
813831
doputenv("PGHOST", hostname);

0 commit comments

Comments
 (0)