Updated on 2022-07-29 GMT+08:00

PG_OPCLASS

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 lefthand input.

Table 1 PG_OPCLASS columns

Name

Type

Reference

Description

oid

oid

-

Row identifier (hidden attribute; must be explicitly selected)

opcmethod

oid

PG_AM.oid

Index access method the operator class is for

opcname

name

-

Name of the operator class

opcnamespace

oid

PG_NAMESPACE.oid

Namespace to which the operator class belongs

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

boolean

-

Whether the operator class is the default for opcintype. If it is, its value is true.

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.