aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2021-06-13 20:07:50 +0900
committerMichael Paquier <michael@paquier.xyz>2021-06-13 20:07:50 +0900
commit37d4edef00e40085f31bfd578b07c5e319e9818a (patch)
tree485003f945aefec7a9d9197b032d891bf5ca55b7
parent0b619df6daca4ed895b25dad6b4297f33fdc4a00 (diff)
downloadpostgresql-37d4edef00e40085f31bfd578b07c5e319e9818a.tar.gz
postgresql-37d4edef00e40085f31bfd578b07c5e319e9818a.zip
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
-rw-r--r--src/test/perl/TestLib.pm1
-rw-r--r--src/test/regress/pg_regress.c27
2 files changed, 24 insertions, 4 deletions
diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm
index c69aadc43f0..f1f90693a39 100644
--- a/src/test/perl/TestLib.pm
+++ b/src/test/perl/TestLib.pm
@@ -63,6 +63,7 @@ BEGIN
delete $ENV{LC_ALL};
$ENV{LC_MESSAGES} = 'C';
+ # This list should be kept in sync with pg_regress.c.
my @envkeys = qw (
PGCLIENTENCODING
PGCONNECT_TIMEOUT
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index 117a9544eaf..c38594385fa 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -802,14 +802,33 @@ initialize_environment(void)
* we also use psql's -X switch consistently, so that ~/.psqlrc files
* won't mess things up.) Also, set PGPORT to the temp port, and set
* PGHOST depending on whether we are using TCP or Unix sockets.
+ *
+ * This list should be kept in sync with TestLib.pm.
*/
+ /* PGCLIENTENCODING, see above */
+ unsetenv("PGCONNECT_TIMEOUT");
+ unsetenv("PGDATA");
unsetenv("PGDATABASE");
- unsetenv("PGUSER");
+ unsetenv("PGGSSENCMODE");
+ unsetenv("PGGSSLIB");
+ /* PGHOSTADDR, see below */
+ unsetenv("PGKRBSRVNAME");
+ unsetenv("PGPASSFILE");
+ unsetenv("PGPASSWORD");
+ unsetenv("PGREQUIREPEER");
+ unsetenv("PGREQUIRESSL");
unsetenv("PGSERVICE");
+ unsetenv("PGSERVICEFILE");
+ unsetenv("PGSSLCERT");
+ unsetenv("PGSSLCRL");
+ unsetenv("PGSSLKEY");
unsetenv("PGSSLMODE");
- unsetenv("PGREQUIRESSL");
- unsetenv("PGCONNECT_TIMEOUT");
- unsetenv("PGDATA");
+ unsetenv("PGSSLROOTCERT");
+ unsetenv("PGTARGETSESSIONATTRS");
+ unsetenv("PGUSER");
+ /* PGPORT, see below */
+ /* PGHOST, see below */
+
#ifdef HAVE_UNIX_SOCKETS
if (hostname != NULL)
doputenv("PGHOST", hostname);