aboutsummaryrefslogtreecommitdiff
path: root/src/test/perl/PostgreSQL
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2025-06-30 09:49:31 -0400
committerAndrew Dunstan <andrew@dunslane.net>2025-06-30 09:49:50 -0400
commitc3e28e9fd936b83dbb6dfb5003b6221d98f8469c (patch)
tree180c02313152b21984039a313732da1a5103df85 /src/test/perl/PostgreSQL
parent40a96cd1484fdf3ab57e8cb7b09767ec7a7f73b1 (diff)
downloadpostgresql-c3e28e9fd936b83dbb6dfb5003b6221d98f8469c.tar.gz
postgresql-c3e28e9fd936b83dbb6dfb5003b6221d98f8469c.zip
Avoid uninitialized value error in TAP tests' Cluster->psql
If the method is called in scalar context and we didn't pass in a stderr handle, one won't be created. However, some error paths assume that it exists, so in this case create a dummy stderr to avoid the resulting perl error. Per gripe from Oleg Tselebrovskiy <o.tselebrovskiy@postgrespro.ru> and adapted from his patch. Discussion: https://postgr.es/m/378eac5de4b8ecb5be7bcdf2db9d2c4d@postgrespro.ru
Diffstat (limited to 'src/test/perl/PostgreSQL')
-rw-r--r--src/test/perl/PostgreSQL/Test/Cluster.pm8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm
index 49b2c86b29c..301766d2ed9 100644
--- a/src/test/perl/PostgreSQL/Test/Cluster.pm
+++ b/src/test/perl/PostgreSQL/Test/Cluster.pm
@@ -2199,6 +2199,14 @@ sub psql
$ret = $?;
};
my $exc_save = $@;
+
+ # we need a dummy $stderr from hereon, if we didn't collect it
+ if (! defined $stderr)
+ {
+ my $errtxt = "<not collected>";
+ $stderr = \$errtxt;
+ }
+
if ($exc_save)
{