On Fri, Jan 19, 2018 at 06:28:41PM +0900, Amit Langote wrote:
> Do you mean pg_partition_tree(regclass), that returns all partitions in
> the partition tree whose root is passed as the parameter?
>
> Perhaps, like the following (roughly implemented in the attached)?
>
> select pg_partition_root(p) as root_parent,
> pg_partition_parent(p) as parent,
> p as relname,
> pg_total_relation_size(p) as size
> from pg_partition_tree_tables('p') p
> order by 4;
> root_parent | parent | relname | size
> -------------+--------+---------+---------
> p | | p | 0
> p | p | p123 | 0
> p | p123 | p12 | 0
> p | p123 | p3 | 3653632
> p | p12 | p1 | 3653632
> p | p12 | p2 | 3653632
> (6 rows)
It seems that you caught the idea. As long as each leaf and root is
listed uniquely, that would be acceptable to me, and useful for users.
If pg_partition_tree_tables() uses the top of the partition as input,
all the tree should show up. If you use a leaf, anything under the leaf
should show up. If a leaf is defined and it has no underlying leaves,
then only this outmost leaf should be listed.
+/*
+ * Returns Oids of tables in a publication.
+ */
Close enough, but that's not a publication.
>> Documentation, as well as regression tests, would be welcome :)
>
> OK, I will add those things in the next version.
Thanks.
--
Michael