我有Postgres 10+。假设我通过RANGE用几个分区创建了一个声明性分区表。
如何获取特定分区的边界?
答案 0 :(得分:1)
边界存储在分区的relpartbound
条目的pg_class
列中。此查询显示所有分区的名称及其分区范围:
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;