Skip to content

Commit a9e0b3b

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 f452aaf commit a9e0b3b

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

src/test/perl/TestLib.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ BEGIN
104104
delete $ENV{LC_ALL};
105105
$ENV{LC_MESSAGES} = 'C';
106106

107+
# This list should be kept in sync with pg_regress.c.
107108
my @envkeys = qw (
108109
PGCHANNELBINDING
109110
PGCLIENTENCODING

src/test/regress/pg_regress.c

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -819,14 +819,38 @@ initialize_environment(void)
819819
* we also use psql's -X switch consistently, so that ~/.psqlrc files
820820
* won't mess things up.) Also, set PGPORT to the temp port, and set
821821
* PGHOST depending on whether we are using TCP or Unix sockets.
822+
*
823+
* This list should be kept in sync with TestLib.pm.
822824
*/
825+
unsetenv("PGCHANNELBINDING");
826+
/* PGCLIENTENCODING, see above */
827+
unsetenv("PGCONNECT_TIMEOUT");
828+
unsetenv("PGDATA");
823829
unsetenv("PGDATABASE");
824-
unsetenv("PGUSER");
830+
unsetenv("PGGSSENCMODE");
831+
unsetenv("PGGSSLIB");
832+
/* PGHOSTADDR, see below */
833+
unsetenv("PGKRBSRVNAME");
834+
unsetenv("PGPASSFILE");
835+
unsetenv("PGPASSWORD");
836+
unsetenv("PGREQUIREPEER");
837+
unsetenv("PGREQUIRESSL");
825838
unsetenv("PGSERVICE");
839+
unsetenv("PGSERVICEFILE");
840+
unsetenv("PGSSLCERT");
841+
unsetenv("PGSSLCRL");
842+
unsetenv("PGSSLCRLDIR");
843+
unsetenv("PGSSLKEY");
844+
unsetenv("PGSSLMAXPROTOCOLVERSION");
845+
unsetenv("PGSSLMINPROTOCOLVERSION");
826846
unsetenv("PGSSLMODE");
827-
unsetenv("PGREQUIRESSL");
828-
unsetenv("PGCONNECT_TIMEOUT");
829-
unsetenv("PGDATA");
847+
unsetenv("PGSSLROOTCERT");
848+
unsetenv("PGSSLSNI");
849+
unsetenv("PGTARGETSESSIONATTRS");
850+
unsetenv("PGUSER");
851+
/* PGPORT, see below */
852+
/* PGHOST, see below */
853+
830854
#ifdef HAVE_UNIX_SOCKETS
831855
if (hostname != NULL)
832856
setenv("PGHOST", hostname, 1);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy