| From: | Oleg Tselebrovskiy <o(dot)tselebrovskiy(at)postgrespro(dot)ru> |
|---|---|
| To: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | psql's 001_basic.pl test could fail on very slow machines |
| Date: | 2026-03-02 12:17:13 |
| Message-ID: | 19b12bef6bbcb2020467804ba5445349@postgrespro.ru |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
psql's 001_basic.pl test could fail on very slow machines
Greetings, everyone!
I've gotten a very-very rare failure of psql's 001_basic.pl:
# +++ tap check in src/bin/psql +++
t/001_basic.pl ................. 79/?
# Failed test '\watch, 2 minimum rows: matches'
# at t/001_basic.pl line 380.
# ''
# doesn't match '(?^l:^123$)'
# Looks like you failed 1 test of 110.
t/001_basic.pl ................. Dubious, test returned 1 (wstat 256,
0x100)
Failed 1/110 subtests
The failed query itself:
psql_like(
$node,
sprintf(
q{with x as (
select now()-backend_start AS howlong
from pg_stat_activity
where pid = pg_backend_pid()
) select 123 from x where howlong < '2 seconds' \watch i=%g m=2},
0.5),
qr/^123$/,
'\watch, 2 minimum rows');
It seems that on very slow machines time between backend's start and
actual query execution can be more than two seconds
You can reproduce something similar with first attached patch,
manual_reproduction, using post_auth_delay
This can be reproduced on 17+ since this is when m[in_rows] was
introduced
Since this test checks that "\watch" clause "m[in_rows]" stops query
execution if amount of rows is less than the value of m,
we could simplify the test by replacing pg_stat_activity access
with plain select (see second attached patch, rewrite_test)
| Attachment | Content-Type | Size |
|---|---|---|
| 0001_manual_reproduction.patch | text/x-diff | 640 bytes |
| 0001_rewrite_test.patch | text/x-diff | 511 bytes |
| From | Date | Subject | |
|---|---|---|---|
| Previous Message | David Geier | 2026-03-02 12:04:55 | Re: Use correct collation in pg_trgm |