| From: | Bryan Green <dbryan(dot)green(at)gmail(dot)com> |
|---|---|
| To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | [PATCH] Avoid uninitialized-value error in poll_query_until timeout diagnostic |
| Date: | 2026-08-09 02:59:57 |
| Message-ID: | 0f515c6d-6032-4c5f-80ac-5c78faae9522@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Greetings,
PostgreSQL::Test::Cluster::poll_query_until() accepts an undefined query
for connection-only checks -- several recovery TAP tests call it that way:
$node->poll_query_until('postgres', undef, '');
On timeout it builds a diag message that interpolates $query:
diag qq(poll_query_until timed out executing this query:
$query
...);
Cluster.pm runs under "use warnings FATAL => 'all'", so when $query is
undefined this does not warn, it dies with "Use of uninitialized value
$query in concatenation". The result is that a timeout in a connection
only poll fails with an uninitialized-value error instead of printing
the timeout diagnostic the code is trying to produce, hiding the actual
failure.
$ perl -e 'use warnings FATAL => "all"; my $q; my $s = qq(q: $q);'
Use of uninitialized value $q in concatenation (.) or string at -e
line 1.
The fix uses a fallback string when the query is undefined:
my $msg_query = $query // '(undef - connection attempt only)';
and interpolates $msg_query instead. Test-only, one line.
--
Bryan Green
EDB: https://www.enterprisedb.com
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Avoid-uninitialized-value-error-in-poll_query_until-.patch | text/plain | 1.5 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Scott Ray | 2026-08-09 03:16:36 | Re: pg_xmin_horizon: a system view of everything pinning the xmin horizon |
| Previous Message | Bruce Momjian | 2026-08-08 23:48:33 | Re: Adding comments to extension objects |