Re: [patch] Have psql's \d+ indicate foreign partitions

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Ian Lawrence Barwick <barwick(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [patch] Have psql's \d+ indicate foreign partitions
Date: 2022-11-01 05:55:33
Message-ID: Y2C01WCVwGACkk79@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2022-11-01 07:03:11 Re: ICU for global collation
Previous Message Tom Lane 2022-11-01 05:52:02 Re: Check return value of pclose() correctly