WITH RECURSIVE partition_info(relid, relname, relsize, relispartition, relkind)
AS (SELECT oid AS relid, relname, pg_relation_size(oid) AS relsize, relispartition, relkind
FROM pg_catalog.pg_class
WHERE relkind = 'p' AND relname = 'mof_ple_part' -- Pour une table donnee.
UNION ALL
SELECT c.oid AS relid, c.relname AS relname, pg_relation_size(c.oid) AS relsize,
c.relispartition AS relispartition, c.relkind AS relkind
FROM partition_info AS p, pg_catalog.pg_inherits AS i, pg_catalog.pg_class AS c
WHERE p.relid = i.inhparent AND c.oid = i.inhrelid AND c.relispartition)
SELECT * FROM partition_info;
select relnamespace::regnamespace::text schema_name, oid::regclass::text table_name from pg_class
where relkind = 'p' and oid in (select distinct inhparent from pg_inherits)
order by schema_name, table_name;