pg_partitions

The pg_partitions system view is used to show the structure of a partitioned table.

Table 1. pg_catalog.pg_partitions

columntypereferencesdescription
schemanamename The name of the schema the partitioned table is in.
tablenamename The name of the top-level parent table.
partitiontablenamename The relation name of the partitioned table (this is the table name to use if accessing the partition directly).
partitionnamename The name of the partition (this is the name to use if referring to the partition in an ALTER TABLE command). NULL if the partition was not given a name at create time or generated by an EVERY clause.
parentpartitiontablenamename The relation name of the parent table one level up from this partition.
parentpartitionnamename The given name of the parent table one level up from this partition.
partitiontypetext The type of partition (range or list).
partitionlevelsmallint The level of this partition in the hierarchy.
partitionrankbigint For range partitions, the rank of the partition compared to other partitions of the same level.
partitionpositionsmallint The rule order position of this partition.
partitionlistvaluestext For list partitions, the list value(s) associated with this partition.
partitionrangestarttext For range partitions, the start value of this partition.
partitionstartinclusiveboolean T if the start value is included in this partition. F if it is excluded.
partitionrangeendtext For range partitions, the end value of this partition.
partitionendinclusiveboolean T if the end value is included in this partition. F if it is excluded.
partitioneveryclausetext The EVERY clause (interval) of this partition.
partitionisdefaultboolean T if this is a default partition, otherwise F.
partitionboundarytext The entire partition specification for this partition.