psql: Fix expanded aligned output

Michael Paquier <michael@paquier.xyz>

Commit: 022ba5c61412765d6aa3792b4dcfadc1ccbd72d3
Author: Michael Paquier <michael@paquier.xyz>
Date: 2026-06-08T05:38:00Z
psql: Fix expanded aligned output

When a table's columns are narrower than the record header line, the
expanded aligned format produced misaligned output because the data
column width was not adjusted to match the record header width, leading
to output like:
+-[ RECORD 1 ]-+
| a | 10 |
| b | 20 |
+---+----+

This commit adjusts the output so as the column width match with the
header line, giving:
+-[ RECORD 1 ]-+
| a | 10       |
| b | 20       |
+---+----------+

Author: Pavel Stehule <pavel.stehule@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAFj8pRCzGpsr9zTHbtTd4mGh2YPJqOEgLgt8JLiopuYA9_1xGw@mail.gmail.com
Backpatch-through: 14

Files

PathChange+/−
src/fe_utils/print.c modified +4 −3
src/test/regress/expected/psql.out modified +26 −0
src/test/regress/sql/psql.sql modified +11 −0

Discussion