Re: partition tree inspection functions - Mailing list pgsql-hackers

From Jesper Pedersen
Subject Re: partition tree inspection functions
Date
Msg-id 8d200fc4-dda4-f4ee-4f9c-efdb05a12e59@redhat.com
Whole thread Raw
In response to Re: partition tree inspection functions  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
List pgsql-hackers
Hi,

On 08/07/2018 03:32 AM, Amit Langote wrote:
> Do we need a pg_partition_level that expects the individual partition OID
> to be passed to it or can we do with the information we get from the
> revised pg_partition_children?  In earlier revisions,
> pg_partition_children returned only the partition OIDs, so we needed to
> provide pg_partition_* functions for getting the parent, root parent,
> level, etc. separately.  I mean to ask if is there a need for having these
> functions separately if the revised pg_partition_children already outputs
> that information?
>

I'm thinking of the case where we only have information about a leaf 
partition, and we need its root partition and the actual level in the 
partition tree.

If we had

  SELECT pg_partition_root_parent('leafpart');

and

  SELECT pg_partition_level('leafpart');

-- we don't need the pg_partition_level('leafpart', 'parentpart') 
function now.

We can use pg_partition_children() for the rest.

> pg_partition_leaf_children()'s output can be obtained as follows, after
> adding isleaf column to pg_partition_children's output:
>

Yes, this is great.

Thanks !

Best regards,
  Jesper


pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Negotiating the SCRAM channel binding type
Next
From: Tomas Vondra
Date:
Subject: Re: Standby trying "restore_command" before local WAL