Re: bugfix - fix broken output in expanded aligned format, when data are too short

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: bugfix - fix broken output in expanded aligned format, when data are too short
Date: 2026-03-24 06:12:18
Message-ID: FD1712E1-9646-4438-BD17-97E08CE70BEC@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Mar 24, 2026, at 13:46, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>
> Hi
>
> new version
>
> * fixed unwanted forcing to wrapped mode
> * regress test
>
> Regards
>
> Pavel
> <v20260324-1-0001-The-output-of-thin-table-is-broken-in-expanded-mode-.patch>

Thanks for the fix. The patch overall looks good to me. A couple of small comments:

1
```
/*
* Calculate available width for data in wrapped mode
*/
- if (cont->opt->format == PRINT_WRAPPED)
+ if (cont->opt->format == PRINT_WRAPPED || cont->opt->format == PRINT_ALIGNED)
```

Since the condition has been updated, I think the comment above should be adjusted as well.

2
```
+-- the output in expanded mode is shorter than header
+\pset border 2
+\pset expanded on
+create table psql_short_tab(a int, b int);
+insert into psql_short_tab values(10,20),(30,40);
+\pset format aligned
+select * from psql_short_tab;
+\pset format wrapped
+select * from psql_short_tab;
+drop table psql_short_tab;
+
```

After this test, does it make sense to turn expanded mode off explicitly, in case it affects following tests? Today the next test happens to reset it, but maybe tomorrow a new test gets added before that point.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rushabh Lathia 2026-03-24 06:27:09 ORDER BY ALL
Previous Message Zsolt Parragi 2026-03-24 06:12:01 Re: [Patch] New pg_stat_tablespace view