8000 Ignore more environment variables in pg_regress.c · postgres/postgres@d31c316 · GitHub
[go: up one dir, main page]

Skip to content

Commit d31c316

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 1b48dd5 commit d31c316

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
@@ -56,6 +56,7 @@ BEGIN
5656
delete $ENV{LC_ALL};
5757
$ENV{LC_MESSAGES} = 'C';
5858

59+
# This list should be kept in sync with pg_regress.c.
5960
my @envkeys = qw (
6061
PGCLIENTENCODING
6162
PGCONNECT_TIMEOUT

src/test/regress/pg_regress.c

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

0 commit comments

Comments
 (0)
0