Re: psql \dh: List High-Level (Root) Tables and Indexes

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Sadeq Dousti <msdousti@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2025-02-23T20:47:09Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. psql \dP: list partitioned tables and indexes

Sadeq Dousti <msdousti@gmail.com> writes:
> Please find attached the patch to add a new metacommand (\dh) to psql.

I don't have a strong feeling one way or the other about whether this
is useful functionality or not.  But if we do want it, I'd like to
bikeshed on the name a bit.  "High-level" is not terminology we use
anywhere else, and it's ambiguous too (just how high in a partition
tree does a table need to be to be listed?).  We do use the terms
"root partition" or "partition root".  So I'd prefer something
based on those terms.  Possibilities:

1. Use "\dr" or maybe better "\dR" (letting \dr remain available for
some future command about roles).  The trouble with either of these
is that the name is already partially overloaded, since we already
have \drds, \drg, \dRp, \dRs.

2. Extend the existing \dP (display partitions) command with some
flag that restricts the listing to root partitions, probably
"r" for "root".

  \dP[itnx+] [PATTERN]   list [only index/table] partitioned relations [n=nested
]

I kind of like #2 better, but am not set on it.

While we're at it maybe we could bring some sanity to the "n"
flag, which seems to have several bizarre properties like
working differently depending on whether you give a pattern.
It looks from this documentation like it's the inverse of what
"r" would do, but testing says it's not.

			regards, tom lane