Summary
The catalog pg_partitioned_table stores information about how tables are partitioned.
(Description quoted from the official PostgreSQL documentation.)
Columns
The pg_partitioned_table system catalog exposes the following columns (names, types and descriptions are taken verbatim from the PostgreSQL documentation):
partrelidoidreferencespg_class.oid
The OID of the pg_class entry for this partitioned tablepartstratchar
Partitioning strategy; h = hash partitioned table, l = list partitioned table, r = range partitioned tablepartnattsint2
The number of columns in the partition keypartdefidoidreferencespg_class.oid
The OID of the pg_class entry for the default partition of this partitioned table, or zero if this partitioned table does not have a default partitionpartattrsint2vectorreferencespg_attribute.attnum
This is an array of partnatts values that indicate which table columns are part of the partition key. For example, a value of 1 3 would mean that the first and the third table columns make up the partition key. A zero in this array indicates that the corresponding partition key column is an expression, rather than a simple column reference.partclassoidvectorreferencespg_opclass.oid
For each column in the partition key, this contains the OID of the operator class to use. See pg_opclass for details.partcollationoidvectorreferencespg_collation.oid
For each column in the partition key, this contains the OID of the collation to use for partitioning, or zero if the column is not of a collatable data type.partexprspg_node_tree
Expression trees (in nodeToString() representation) for partition key columns that are not simple column references. This is a list with one element for each zero entry in partattrs. Null if all partition key columns are simple references.
Related catalogs
This object references the following other system catalogs:
partrelid→pg_classpartattrs→pg_attributepartclass→pg_opclasspartcollation→pg_collation
Version applicability
Present in PostgreSQL 17, 18, 19 (verified against each release’s documentation). This is a long-standing system object that also exists in earlier PostgreSQL releases.
Related & references
Reference: PostgreSQL documentation — pg_partitioned_table.