Fix how some lists are displayed by psql \d+

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Fix how some lists are displayed by psql \d+
Date: 2026-01-08 22:47:19
Message-ID: CAHut+Pu1puO00C-OhgLnAcECzww8MB3Q8DCsvx0cZWHRfs4gBQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi.

I recently saw that the psql \d+ lists for "Partitions:" are not
aligned in quite the same way as other lists ("Publications:" etc)
because they use indents and line breaks differently. e.g. See below:

test_pub=# \d+ part1
Partitioned table "public.part1"
Column | Type | Collation | Nullable | Default | Storage |
Compression | Stats target | Description
--------+---------+-----------+----------+---------+---------+-------------+--------------+-------------
a | integer | | | | plain |
| |
Partition of: t1 FOR VALUES FROM (0) TO (50)
Partition constraint: ((a IS NOT NULL) AND (a >= 0) AND (a < 50))
Partition key: RANGE (a)
Publications:
"pub1"
"pub2"
"pub_only"
Partitions: part1_1 FOR VALUES FROM (0) TO (25), PARTITIONED,
part1_2 FOR VALUES FROM (25) TO (50)

~~~

PSA v1
0001 - Fix (common code) lists for "Partitions:" and "Child tables:"
0002 - Fix list for "Inherits:" in the same way

~~~

The *patched* result for the same example now looks like below. Notice
that in passing I also removed the comma separators, which are not
present in the other footer lists.

test_pub=# \d+ part1
Partitioned table "public.part1"
Column | Type | Collation | Nullable | Default | Storage |
Compression | Stats target | Description
--------+---------+-----------+----------+---------+---------+-------------+--------------+-------------
a | integer | | | | plain |
| |
Partition of: t1 FOR VALUES FROM (0) TO (50)
Partition constraint: ((a IS NOT NULL) AND (a >= 0) AND (a < 50))
Partition key: RANGE (a)
Publications:
"pub1"
"pub2"
"pub_only"
Partitions:
part1_1 FOR VALUES FROM (0) TO (25), PARTITIONED
part1_2 FOR VALUES FROM (25) TO (50)

======
Kind Regards,
Peter Smith.
Fujitsu Australia

Attachment Content-Type Size
v1-0002-Fix-to-make-psql-d-lists-of-inherits-look-same-as.patch application/octet-stream 35.4 KB
v1-0001-Fix-to-make-psql-d-lists-of-partitions-look-same-.patch application/octet-stream 29.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Haibo Yan 2026-01-08 22:52:29 Re: pg_plan_advice
Previous Message Nathan Bossart 2026-01-08 22:20:05 Re: Wake up autovacuum launcher from postmaster when a worker exits