select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

FUNCTIONS / SYSTEM ADMINISTRATION FUNCTIONS

pg_partition_tree

Read PG 18 manual ↗

Lists the tables or indexes in the partition tree of the given partitioned table or partitioned index, with one row for each partition.

Signatures & examples

pg_partition_tree ( regclass ) → setof record ( relid regclass, parentrelid regclass, isleaf boolean, level integer )
Lists the tables or indexes in the partition tree of the given partitioned table or partitioned index, with one row for each partition. Information provided includes the OID of the partition, the OID of its immediate parent, a boolean value telling if the partition is a leaf, and an integer telling its level in the hierarchy. The level value is 0 for the input table or index, 1 for its immediate child partitions, 2 for their partitions, and so on. Returns no rows if the relation does not exist or is not a partition or partitioned table.
Version history 2
  1. PG 12 → 13changed
  2. PG 11 → 12added

Definition snapshot: 2026-09-14T13:14:25.684213+00:00@99e6866c · English manual source