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

From Jesper Pedersen
Subject Re: partition tree inspection functions
Date
Msg-id 7f2e6674-9196-9fe7-1405-368bafd64198@redhat.com
Whole thread Raw
In response to Re: partition tree inspection functions  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Responses Re: partition tree inspection functions
Re: partition tree inspection functions
List pgsql-hackers
Hi Amit,

On 08/03/2018 04:28 AM, Amit Langote wrote:
> That's a good idea, thanks.
> 
> Actually, by the time I sent the last version of the patch or maybe few
> versions before that, I too had started thinking if we shouldn't just have
> a SETOF RECORD function like you've outlined here, but wasn't sure of the
> fields it should have.  (relid, parentid, level) seems like a good start,
> or maybe that's just what we need.
> 

I think there should be a column that identifies leaf partitions (bool 
isleaf), otherwise it isn't obvious in complex scenarios.

> 
> Note that the level that's returned for each table is computed wrt the
> root table passed to the function and not the actual root partition.
> 

If you are given a leaf partition as input, then you will have to keep 
executing the query until you find the root, and count those. So, I 
think it should be either be the level to the root, or there should be 
another column that lists that (rootlevel).

Best regards,
  Jesper


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Alter index rename concurrently to
Next
From: Tomas Vondra
Date:
Subject: Re: [PATCH] Improve geometric types