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