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

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Show comments in \dRp+, \dRs+, and \dX+ psql meta-commands
Date: 2026-02-26 03:32:32
Message-ID: CAHGQGwFJKg-aT5vajSU1v_B4K129u_SjZ3EGGHFSBhW967gcMA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Feb 20, 2026 at 6:29 PM Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> wrote:
>
> Hi Fujii,
>
> Due to recent changes in describe.c and subscription.out, v1 was no
> longer applying. I rebased it just to test the feature -- feel free to
> revert it.
>
> v2 attached.

Thanks for reviewing and rebasing the patch!

I noticed that I forgot to update the psql help message for \dX+,
so I've revised the patch. Attached is v3.

> One unrelated thing caught my attention though: NULLs and empty strings
> are both displayed as NULL, which is expected according to
> CreateComments() in comment.c
>
> ...
> /* Reduce empty-string to NULL case */
> if (comment != NULL && strlen(comment) == 0)
> comment = NULL;
> ...
>
> However, I couldn't find anything in the docs that clearly says that
> it's going to be the case -- at least not in comment.sgml.
>
> CREATE SEQUENCE s1;
> COMMENT ON SEQUENCE s1 IS '';
> CREATE SEQUENCE s2;
> COMMENT ON SEQUENCE s2 IS NULL;
>
> postgres=# \ds+
> List of sequences
> -[ RECORD 1 ]-----------
> Schema | public
> Name | s1
> Type | sequence
> Owner | jim
> Persistence | permanent
> Size | 8192 bytes
> Description | (null)
> -[ RECORD 2 ]-----------
> Schema | public
> Name | s2
> Type | sequence
> Owner | jim
> Persistence | permanent
> Size | 8192 bytes
> Description | (null)
>
> Is it perhaps an undocumented behaviour?

I'm not sure why this behavior isn't documented, but it seems worth
addressing in a separate documentation patch.

Regards,

--
Fujii Masao

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-02-26 03:33:22 Re: Flush some statistics within running transactions
Previous Message Chao Li 2026-02-26 03:08:28 Re: Add errdetail() with PID and UID about source of termination signal