Postgres: To get list of all partitions of a table
SELECT
child.relname AS partition_name
FROM
pg_class base_tb
JOIN
pg_inherits i ON i.inhparent = base_tb.oid
JOIN
pg_class child ON i.inhrelid = child.oid
LEFT JOIN
pg_partitioned_table pt ON pt.partrelid = child.oid
WHERE
base_tb.relname = 'coupons';
Comments
Post a Comment