September 26, 2024: PostgreSQL 17 Released!
Supported Versions: Current (17) / 16 / 15 / 14 / 13 / 12
Development Versions: devel
Unsupported versions: 11 / 10 / 9.6 / 9.5 / 9.4 / 9.3 / 9.2 / 9.1 / 9.0 / 8.4 / 8.3 / 8.2 / 8.1 / 8.0 / 7.4 / 7.3

51.33. pg_opclass

The catalog pg_opclass defines index access method operator classes. Each operator class defines semantics for index columns of a particular data type and a particular index access method. An operator class essentially specifies that a particular operator family is applicable to a particular indexable column data type. The set of operators from the family that are actually usable with the indexed column are whichever ones accept the column's data type as their left-hand input.

Operator classes are described at length in Section 37.16.

Table 51.33. pg_opclass Columns

Name Type References Description
oid oid   Row identifier
opcmethod oid pg_am.oid Index access method operator class is for
opcname name   Name of this operator class
opcnamespace oid pg_namespace.oid Namespace of this operator class
opcowner oid pg_authid.oid Owner of the operator class
opcfamily oid pg_opfamily.oid Operator family containing the operator class
opcintype oid pg_type.oid Data type that the operator class indexes
opcdefault bool   True if this operator class is the default for opcintype
opckeytype oid pg_type.oid Type of data stored in index, or zero if same as opcintype

An operator class's opcmethod must match the opfmethod of its containing operator family. Also, there must be no more than one pg_opclass row having opcdefault true for any given combination of opcmethod and opcintype.

Submit correction

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.