Skip to content

pg_partitions

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

columntypereferencesdescription
schemanamenameThe name of the schema the partitioned table is in.
tablenamenameThe name of the top-level parent table.
partitionschemanamenameThe namespace of the partition table.
partitiontablenamenameThe relation name of the partitioned table (this is the table name to use if accessing the partition directly).
partitionnamenameThe 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.
parentpartitiontablenamenameThe relation name of the parent table one level up from this partition.
parentpartitionnamenameThe given name of the parent table one level up from this partition.
partitiontypetextThe type of partition (range or list).
partitionlevelsmallintThe level of this partition in the hierarchy.
partitionrankbigintFor range partitions, the rank of the partition compared to other partitions of the same level.
partitionpositionsmallintThe rule order position of this partition.
partitionlistvaluestextFor list partitions, the list value(s) associated with this partition.
partitionrangestarttextFor range partitions, the start value of this partition.
partitionstartinclusivebooleanT if the start value is included in this partition. F if it is excluded.
partitionrangeendtextFor range partitions, the end value of this partition.
partitionendinclusivebooleanT if the end value is included in this partition. F if it is excluded.
partitioneveryclausetextThe EVERY clause (interval) of this partition.
partitionisdefaultbooleanT if this is a default partition, otherwise F.
partitionboundarytextThe entire partition specification for this partition.
parenttablespacetextThe tablespace of the parent table one level up from this partition.
partitiontablespacetextThe tablespace of this partition.

Parent topic: System Catalogs Definitions