Postgresql 中文操作指南

53.33. pg_opclass #

记录 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.

Section 38.16 中对运算符类进行了详细描述。

Operator classes are described at length in Section 38.16.

Table 53.33. pg_opclass Columns

Table 53.33. pg_opclass Columns

Column Type

Description

oid oid

Row identifier

opcmethod oid (references pg_am.oid)

Index access method operator class is for

opcname name

Name of this operator class

opcnamespace oid (references pg_namespace.oid)

Namespace of this operator class

opcowner oid (references pg_authid.oid)

Owner of the operator class

opcfamily oid (references pg_opfamily.oid)

Operator family containing the operator class

opcintype oid (references pg_type.oid)

Data type that the operator class indexes

opcdefault bool

True if this operator class is the default for opcintype

opckeytype oid (references pg_type.oid)

Type of data stored in index, or zero if same as opcintype

一个操作符类`opcmethod`必须与它包含的操作符族的`opfmethod`匹配。此外,对于任何`opcmethod`和`opcintype`组合,都不能有多个`pg_opclass`行为`opcdefault`为真。

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.