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

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: [patch] Have psql's \d+ indicate foreign partitions
Дата
Msg-id Y2C01WCVwGACkk79@paquier.xyz
обсуждение исходный текст
Ответ на [patch] Have psql's \d+ indicate foreign partitions  (Ian Lawrence Barwick <barwick@gmail.com>)
Ответы Re: [patch] Have psql's \d+ indicate foreign partitions  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Check return value of pclose() correctly
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: ICU for global collation