Skip to content

Commit 545aa6a

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 94e2102 commit 545aa6a

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

src/test/perl/TestLib.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ BEGIN
9898
delete $ENV{LC_ALL};
9999
$ENV{LC_MESSAGES} = 'C';
100100

101+
# This list should be kept in sync with pg_regress.c.
101102
my @envkeys = qw (
102103
PGCHANNELBINDING
103104
PGCLIENTENCODING

src/test/regress/pg_regress.c

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -805,14 +805,36 @@ initialize_environment(void)
805805
* we also use psql's -X switch consistently, so that ~/.psqlrc files
806806
* won't mess things up.) Also, set PGPORT to the temp port, and set
807807
* PGHOST depending on whether we are using TCP or Unix sockets.
808+
*
809+
* This list should be kept in sync with TestLib.pm.
808810
*/
811+
unsetenv("PGCHANNELBINDING");
812+
/* PGCLIENTENCODING, see above */
813+
unsetenv("PGCONNECT_TIMEOUT");
814+
unsetenv("PGDATA");
809815
unsetenv("PGDATABASE");
810-
unsetenv("PGUSER");
816+
unsetenv("PGGSSENCMODE");
817+
unsetenv("PGGSSLIB");
818+
/* PGHOSTADDR, see below */
819+
unsetenv("PGKRBSRVNAME");
820+
unsetenv("PGPASSFILE");
821+
unsetenv("PGPASSWORD");
822+
unsetenv("PGREQUIREPEER");
823+
unsetenv("PGREQUIRESSL");
811824
unsetenv("PGSERVICE");
825+
unsetenv("PGSERVICEFILE");
826+
unsetenv("PGSSLCERT");
827+
unsetenv("PGSSLCRL");
828+
unsetenv("PGSSLKEY");
829+
unsetenv("PGSSLMAXPROTOCOLVERSION");
830+
unsetenv("PGSSLMINPROTOCOLVERSION");
812831
unsetenv("PGSSLMODE");
813-
unsetenv("PGREQUIRESSL");
814-
unsetenv("PGCONNECT_TIMEOUT");
815-
unsetenv("PGDATA");
832+
unsetenv("PGSSLROOTCERT");
833+
unsetenv("PGTARGETSESSIONATTRS");
834+
unsetenv("PGUSER");
835+
/* PGPORT, see below */
836+
/* PGHOST, see below */
837+
816838
#ifdef HAVE_UNIX_SOCKETS
817839
if (hostname != NULL)
818840
doputenv("PGHOST", hostname);

0 commit comments

Comments
 (0)