Reputation: 313
I have postgres 10+. Assuming I create a declarative partitioned table by RANGE with several partitions.
How can I retrieve the boundaries of a specific partition?
Upvotes: 2
Views: 2063
Reputation: 246163
The bounds are stored in the relpartbound
column of the pg_class
entry of the partitions. This query prints the names of all partitions and their partition bounds:
SELECT t.oid::regclass AS partition,
pg_get_expr(t.relpartbound, t.oid) AS bounds
FROM pg_inherits AS i
JOIN pg_class AS t ON t.oid = i.inhrelid
WHERE i.inhparent = 'partitioned_table'::regclass;
Upvotes: 8