Re: DOCS - "\d mytable" also shows any publications that publish mytable

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: Peter Smith <smithpb2250(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: DOCS - "\d mytable" also shows any publications that publish mytable
Date: 2025-12-25 00:44:53
Message-ID: CAHGQGwFDAHyNLCT7YrjWDx6y-6W3G720rD+_+ZZMjs7A0V2F5A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 24, 2025 at 8:41 AM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
>
>
>
> > On Dec 24, 2025, at 06:20, Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
> >
> > On Tue, Dec 23, 2025 at 7:28 PM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
> >>
> >>
> >>
> >>> On Dec 23, 2025, at 05:07, Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
> >>>
> >>> I was looking at "\d" documentation yesterday.
> >>>
> >>> The psql table describe (e.g. "\d mytable") will display a list of any
> >>> "Publications:" that are publishing the specified table. Somehow, this
> >>> ability had escaped being mentioned in the psql reference
> >>> documentation.
> >>>
> >>> Here is a trivial patch to fix that omission.
> >>>
> >>> ======
> >>> Kind Regards,
> >>> Peter Smith.
> >>> Fujitsu Australia
> >>> <v1-0001-DOCS-psql-describe-table-can-list-publications.patch>
> >>
> >> Not only publication, “\d table_name” also shows partition information:
> >>
> >> ```
> >> evantest=# \d t_part;
> >> Partitioned table "public.t_part"
> >> Column | Type | Collation | Nullable | Default
> >> --------+---------+-----------+----------+---------
> >> id | integer | | |
> >> val | integer | | |
> >> Partition key: RANGE (id)
> >> Publications:
> >> "mypub"
> >> Number of partitions: 3 (Use \d+ to list them.)
> >>
> >> evantest=# \d t_part_p1;
> >> Table "public.t_part_p1"
> >> Column | Type | Collation | Nullable | Default
> >> --------+---------+-----------+----------+---------
> >> id | integer | | |
> >> val | integer | | |
> >> Partition of: t_part FOR VALUES FROM (0) TO (100)
> >> ```
> >>
> >> As you updating this section, you may add “partition info” as well.
> >>
> >
> > OK, I've added some text about partitions. See patch v2.
> >
> > ~~~
> >
> > TBH, the \d and \d+ partition output looked strange to me.
> >
> > test_pub=# \d+ tp
> > Partitioned table "public.tp"
> > Column | Type | Collation | Nullable | Default | Storage |
> > Compression | Stats target | Description
> > --------+---------+-----------+----------+---------+---------+-------------+--------------+-------------
> > a | integer | | | | plain |
> > | |
> > Partition key: RANGE (a)
> > Publications:
> > "pub1"
> > "pub3"
> > Partitions: tp1 FOR VALUES FROM (1) TO (10),
> > tp2 FOR VALUES FROM (10) TO (20)
> >
> > For example:
> > a) Why isn't the "Partition key:" and "Partitions:" info kept together?
>
> I guess it shows the plus stuff after the regular stuff.
>
> > b) Why does the "Partitions:" list indentation look different?
>
> Yeah, the list indentation should be identical.
>
> >
> > Anyway, those are questions for another thread and another year.
> >
> > ======
> > Kind Regards,
> > Peter Smith.
> > Fujitsu Australia
> > <v2-0001-DOCS-psql-describe-table-can-list-publications-an.patch>
>
> V2 looks good to me.

\d table also seems to display tablespaces, policies, and other objects.
Should the documentation try to list all possible objects that can be shown?

If maintaining a complete list is difficult, would a more general description
like "Associated objects, including indexes, constraints, rules, publications,
and so on, are also shown." be sufficient instead of enumerating everything?

Regards,

--
Fujii Masao

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2025-12-25 00:45:33 Re: [Proposal] Expose internal MultiXact member count function for efficient monitoring
Previous Message Michael Paquier 2025-12-25 00:24:57 Re: Fwd: [PATCH] Add zstd compression for TOAST using extended header format