Make psql/t/030_pager.pl more robust. master github/master
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 30 Jan 2026 20:11:44 +0000 (15:11 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 30 Jan 2026 20:11:44 +0000 (15:11 -0500)
commit6918434a4acb2b14535b3c1be30d306666db7c24
tree5aff7e9332069eb53baa0028537a0021e4f9c3ca
parenta1d7ae2b2e38dd5d783c91316925f9f395da47e6
Make psql/t/030_pager.pl more robust.

Similarly to the preceding commit, 030_pager.pl was assuming
that patterns it looks for in interactive psql output would
appear by themselves on a line, but that assumption tends to
fall over in builds made --without-readline: the output we
get might have a psql prompt immediately followed by the
expected line of output.

For several of these tests, just checking for the pattern
followed by newline seems sufficient, because we could not
get a false match against the command echo, nor against the
unreplaced command output if the pager fails to be invoked
when expected.  However, that's fairly scary for the test
that was relying on information_schema.referential_constraints:
"\d+" could easily appear at the end of a line in that view.
Let's get rid of that hazard by making a custom test view
instead of using information_schema.referential_constraints.

This test script is new in v19, so no need for back-patch.

Reported-by: Oleg Tselebrovskiy <o.tselebrovskiy@postgrespro.ru>
Author: Oleg Tselebrovskiy <o.tselebrovskiy@postgrespro.ru>
Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Soumya S Murali <soumyamurali.work@gmail.com>
Discussion: https://postgr.es/m/db6fdb35a8665ad3c18be01181d44b31@postgrespro.ru
src/bin/psql/t/030_pager.pl