Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 37d4ede

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 0b619df commit 37d4ede

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

src/test/perl/TestLib.pm

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

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

src/test/regress/pg_regress.c

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -802,14 +802,33 @@ initialize_environment(void)
802802
* we also use psql's -X switch consistently, so that ~/.psqlrc files
803803
* won't mess things up.) Also, set PGPORT to the temp port, and set
804804
* PGHOST depending on whether we are using TCP or Unix sockets.
805+
*
806+
* This list should be kept in sync with TestLib.pm.
805807
*/
808+
/* PGCLIENTENCODING, see above */
809+
unsetenv("PGCONNECT_TIMEOUT");
810+
unsetenv("PGDATA");
806811
unsetenv("PGDATABASE");
807-
unsetenv("PGUSER");
812+
unsetenv("PGGSSENCMODE");
813+
unsetenv("PGGSSLIB");
814+
/* PGHOSTADDR, see below */
815+
unsetenv("PGKRBSRVNAME");
816+
unsetenv("PGPASSFILE");
817+
unsetenv("PGPASSWORD");
818+
unsetenv("PGREQUIREPEER");
819+
unsetenv("PGREQUIRESSL");
808820
unsetenv("PGSERVICE");
821+
unsetenv("PGSERVICEFILE");
822+
unsetenv("PGSSLCERT");
823+
unsetenv("PGSSLCRL");
824+
unsetenv("PGSSLKEY");
809825
unsetenv("PGSSLMODE");
810-
unsetenv("PGREQUIRESSL");
811-
unsetenv("PGCONNECT_TIMEOUT");
812-
unsetenv("PGDATA");
826+
unsetenv("PGSSLROOTCERT");
827+
unsetenv("PGTARGETSESSIONATTRS");
828+
unsetenv("PGUSER");
829+
/* PGPORT, see below */
830+
/* PGHOST, see below */
831+
813832
#ifdef HAVE_UNIX_SOCKETS
814833
if (hostname != NULL)
815834
doputenv("PGHOST", hostname);

0 commit comments

Comments
 (0)