Re: [patch] Have psql's \d+ indicate foreign partitions - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: [patch] Have psql's \d+ indicate foreign partitions
Date
Msg-id Y2C01WCVwGACkk79@paquier.xyz
Whole thread Raw
In response to [patch] Have psql's \d+ indicate foreign partitions  (Ian Lawrence Barwick <barwick@gmail.com>)
Responses Re: [patch] Have psql's \d+ indicate foreign partitions
List pgsql-hackers
On Mon, Oct 24, 2022 at 09:44:18PM +0900, Ian Lawrence Barwick wrote:
> Recently I have been working a lot with partitioned tables which contain a mix
> of local and foreign partitions, and find it would be very useful to be able to
> easily obtain an overview of which partitions are foreign and where they are
> located.
>
> Currently, executing "\d+" on a partitioned table lists the partitions
> like this:

Hmm.  I am not sure that we should add this much amount of
information, particularly for the server bits.  First, worth
mentioning, pg_partition_tree() is very handy when it comes to know
partition information, like:
SELECT relid, relkind
  FROM pg_partition_tree('parttest') p, pg_class c
  where c.oid = p.relid;

Anyway, saying that, we do something similar for partitioned indexes
and tables with \d+, aka around L3445:
   if (child_relkind == RELKIND_PARTITIONED_TABLE ||
       child_relkind == RELKIND_PARTITIONED_INDEX)
       appendPQExpBufferStr(&buf, ", PARTITIONED");

This is the same, just for a new relkind.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Check return value of pclose() correctly
Next
From: Michael Paquier
Date:
Subject: Re: ICU for global collation