Re: partition tree inspection functions

From: Jesper Pedersen <jesper(dot)pedersen(at)redhat(dot)com>
To: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Jeevan Ladhe <jeevan(dot)ladhe(at)enterprisedb(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: partition tree inspection functions
Date: 2018-07-18 14:35:56
Message-ID: 4f4a2518-6c62-5463-6ac2-1241ae9d6041@redhat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Amit,

On 06/28/2018 01:49 AM, Amit Langote wrote:
> OK, I've added an example below the table of functions added by the patch.
>
> Attached updated patch.
>

You forgot to remove the test output in create_table.out, so check-world
is failing.

In pg_partition_parent

+ else
+ /* Not a partition, return NULL. */
+ PG_RETURN_NULL();

I would just remove the "else" such that PG_RETURN_NULL() is fall-through.

I think pg_partition_tree_tables should have an option to exclude the
table that is being queried from the result (bool include_self).

Maybe a function like pg_partition_number_of_partitions() could be of
benefit to count the number of actual partitions in a tree. Especially
useful in complex scenarios,

select pg_partition_number_of_partitions('p') as number;

number
---------
4
(1 row)

New status: WfA

Best regards,
Jesper

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2018-07-18 14:44:10 Re: [HACKERS] Re: [COMMITTERS] pgsql: Remove pgbench "progress" test pending solution of its timing is (fwd)
Previous Message Mai Peng 2018-07-18 14:35:10 Re: Segfault logical replication PG 10.4