The pg_class catalog provides information about tables and other objects that have columns.
| Column name | Data type | Description |
|---|---|---|
oid |
oid |
A row identifier used to uniquely reference a relation. |
relname |
name |
The name of a table, index, view, etc. |
relnamespace |
oid (references pg_namespace.oid) |
The OID of the namespace that contains the relation. |
reltype |
oid (references pg_type.oid) |
The OID of the data type that corresponds to the table’s row type. 0 – For relations without a row type (such as indexes, sequences, and TOAST tables). |
reloftype |
oid |
The OID of the underlying composite type for typed tables. 0 – Other relations. |
relowner |
oid (references pg_authid.oid) |
The OID of the relation owner. |
relam |
oid (references pg_am.oid) |
The OID of the access method used for the table or index. |
relfilenode |
oid |
The file name identifier on disk for this relation; zero if it is a mapped relation. |
reltablespace |
oid |
The OID of the tablespace storing the relation. 0 – Database’s default tablespace. |
relpages |
int4 |
The estimated number of pages in the on-disk representation of the table, updated by maintenance operations. |
reltuples |
float4 |
The estimated number of live rows in the table. -1 – Unknown. |
relallvisible |
int4 |
The estimated number of all-visible pages in the visibility map for this table. |
relallfrozen |
int4 |
The estimated number of all-frozen pages in the visibility map for this table. |
reltoastrelid |
oid |
The OID of the TOAST table associated with the table. 0 – No TOAST table is defined. |
relhasindex |
bool |
Specifies whether the table currently has, or once had, any indexes (TRUE) or not (FALSE). |
relisshared |
bool |
Specifies whether the table is shared across all databases in the cluster (TRUE) or not (FALSE). |
relpersistence |
char |
The relation persistence type:
|
relkind |
char |
The relation type: a table, index, sequence, view, etc. |
relnatts |
int2 |
The number of user-defined columns in the relation, excluding system columns. |
relchecks |
int2 |
The number of CHECK constraints defined on the table. |
relhasrules |
bool |
Specifies whether the table has, or once had, rewrite rules (TRUE) or not (FALSE). |
relhastriggers |
bool |
Specifies whether the table has, or once had, triggers (TRUE) or not (FALSE). |
relhassubclass |
bool |
Specifies whether the table or index has, or once had, inheritance children or partitions (TRUE) or not (FALSE). |
relrowsecurity |
bool |
Specifies whether the table row-level security is enabled (TRUE) or not (FALSE). |
relforcerowsecurity |
bool |
Specifies whether row-level security applies to the table owner as well (TRUE) or not (FALSE). |
relispopulated |
bool |
Specifies whether the relation is populated (TRUE) or not (FALSE). |
relreplident |
char |
The replica identity selection:
|
relispartition |
bool |
Specifies whether the relation is a partition (TRUE) or not (FALSE). |
relrewrite |
oid |
The OID of the original relation during table rewrite operations. 0 – No rewrite is in progress. |
relfrozenxid |
xid |
The transaction ID before which all XIDs have been frozen. 0 – Not applicable. |
relminmxid |
xid |
The multixact ID before which all entries have been frozen. 0 – Not applicable. |
relacl |
aclitem[] |
Access privileges associated with the relation. |
reloptions |
text[] |
Access-method-specific options, represented as keyword=value strings. |
relpartbound |
pg_node_tree |
The internal representation of the partition bound if the relation is a partition. |