Re: Show the conflict log table in \dRs+ output

From: Zhijie Hou <houzhijie22(at)gmail(dot)com>
To: vignesh C <vignesh21(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Show the conflict log table in \dRs+ output
Date: 2026-12-02 09:25:38
Message-ID: 2b7b6f36-a3c0-409d-9ede-39bde36a9672@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Wed, Dec 2, 2026 at 02:45 PM vignesh C wrote:
> Attached is a patch that makes \dRs+ show the conflict log table of a
> subscription as a footer, when conflict_log_destination is set to
> table or all. The name is displayed because the conflict log table is
> a relation that users query directly for diagnostic purposes, making
> it useful to have its name readily visible. It is displayed as a
> footer, following the style of existing \dRp+ footers (for example,
> "Tables from schemas:"). To accommodate this, \dRs+ now displays each
> subscription in a separate table, with the subscription name as its
> title. The output of \dRs without + remains unchanged. The footer is
> titled "Conflict log table:". This approach follows the discussion at
> [1].
>
> This is the same patch as v97 at [2], except for one new test to
> verify the CLT is included as a subscription footer.

Thanks for sharing the patch.

For the patch, I think it is unnecessary to split
describeSubscriptions() into listSubscriptions() and
describeSubscriptions() which duplicates all the column headers and
server-version checks to populate printTable manually. (Most neighboring
functions in describe.c take a (pattern, verbose) interface)

We can avoid that duplication and preserve the existing formatting by
keeping a single describeSubscriptions(pattern, verbose) function,
fetching conflict_log_table as a trailing internal column when verbose
is set, and populating each subscription's printTable from the PGresult
metadata (PQfname(), PQftype(), and column_type_alignment()). I've
attached a top-up patch (nocfbot-0001) to illustrate this.

For the doc:

2. doc/src/sgml/ref/psql-ref.sgml

+ If the subscription logs conflicts to a table (see
+ <xref
linkend="sql-createsubscription-params-with-conflict-log-destination"/>),

Since the target <varlistentry>'s <term> includes "(<type>enum</type>)"
and has no xreflabel, "(see <xref .../>)" renders as
"(see conflict_log_destination (enum))". I think it would be better to
use <link> as in other places to avoid the nested "(enum)":
--
Best Regards,
Zhijie Hou

Attachment Content-Type Size
nocfbot-0001-Top-up-1-Simplify-describeSubscriptions-and-preserve.patch text/plain 59.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2026-12-02 09:32:08 Re: Show the conflict log table in \dRs+ output
Previous Message shveta malik 2026-12-02 09:20:03 Re: Show the conflict log table in \dRs+ output