On Tue, Jun 26, 2018 at 10:38 AM, Amit Langote
<langote_amit...@lab.ntt.co.jp> wrote:
> Hi.
>
> As discussed a little while back [1] and also recently mentioned [2], here
> is a patch that adds a set of functions to inspect the details of a
> partition tree.  There are three functions:
>
> pg_partition_parent(regclass) returns regclass
> pg_partition_root_parent(regclass) returns regclass
> pg_partition_tree_tables(regclass) returns setof regclass
>
>
> select    p as relname,
>           pg_partition_parent(p) as parent,
>           pg_partition_root_parent(p) as root_parent
> from      pg_partition_tree_tables('p') p;
>  relname | parent | root_parent
> ---------+--------+-------------
>  p       |        | p
>  p0      | p      | p
>  p1      | p      | p
>  p00     | p0     | p
>  p01     | p0     | p
>  p10     | p1     | p
>  p11     | p1     | p
> (7 rows)
>

Is it a good idea to provide a function or an option which can provide
partitions detail in hierarchical order?

i.e
relname     level
p                 0
p0               1
p00             2
p01             2
p1               1
....


-- 
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com

Reply via email to