Show comments in \dRp+, \dRs+, and \dX+ psql meta-commands

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Show comments in \dRp+, \dRs+, and \dX+ psql meta-commands
Date: 2026-02-16 14:57:03
Message-ID: CAHGQGwGL4JqiKA26fnGx-cTM=VzoTs_uzqejvj4Fawyr4uLUUw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

The psql meta-commands that list publications, subscriptions, and extended
statistics (\dRp+, \dRs+, and \dX+) do not display their associated comments,
whereas other \d meta-commands do. This makes it inconvenient to view
these objects together with their descriptions.

I'd like to propose the attached patch to improve \dRp+ and \dRs+ so
they include comments for publications and subscriptions. The patch also
extends the \dX meta-command to accept the + option, allowing comments
for extended statistics to be shown when requested. Thoughts?

BTW, while working on this, I also noticed that \dRs+ currently outputs nearly
all subscription parameter settings (for example, [1]), whereas other
\d meta-commands tend to show only a subset of details. So, as new parameters
(or columns in pg_subscription) are added, the number of columns in \dRs+
will continue to grow, which could make the output harder to use.
I think it might be better to exclude parameter settings to keep
the output manageable.

As just idea, it may be sufficient for \dRs+ to display commonly used
identifying information such as Conninfo and Description in addition to
the fields shown by \dRs (Name, Owner, Enabled, and Publication).
Other details (e.g., Failover) could still be viewed directly in
pg_subscription.
Thought?

Regards,

[1]
\dRs+

List of subscriptions
Name | Owner | Enabled | Publication |
Binary | Streaming | Two-phase commit | Disable on error | Origin |
Password required | Run as owner? | Failover | Retain dead tuples |
Max retention duration | Retention active | Synchronous commit |
Conninfo | Skip LSN | Description
-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+----------+--------------------+------------------------+------------------+--------------------+-----------------------------+------------+-------------------
regress_testsub | regress_subscription_user | f | {testpub} |
f | parallel | d | f | any | t
| f | f | f |
0 | f | off |
dbname=regress_doesnotexist | 0/00000000 | test subscription
(1 row)

--
Fujii Masao

Attachment Content-Type Size
v1-0001-psql-Show-comments-in-dRp-dRs-and-dX-psql-meta-co.patch application/octet-stream 135.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2026-02-16 15:05:00 Re: Adding REPACK [concurrently]
Previous Message Ashutosh Bapat 2026-02-16 14:52:51 Re: Better shared data structure management and resizable shared data structures