PG元数据
获取分区表继承关系
with base as (
select
parent.oid AS parent_oid,
parent.relname AS parent_relname,
parent.relkind AS parent_relkind,
child.oid as child_oid,
child.relname as child_relname,
child.relkind as child_relkind
from pg_inherits inh
join (select * from pg_class where relkind in ('r', 'p')) child on child.oid = inh.inhrelid
join (select * from pg_class where relkind in ('r', 'p')) parent on parent.oid = inh.inhparent
)
select * from base