51.33. pg_opclass

В каталоге pg_opclass определяются классы операторов для индексных методов доступа. Каждый класс операторов устанавливает конкретную операцию для индексируемых столбцов определённого типа данных и определённого метода доступа. Класс операторов по сути устанавливает, что некоторое семейство операторов применимо к определённому индексируемому типу столбца. Набор операторов из семейства, которые действительно можно использовать с индексируемым столбцом, образуют те, что принимают тип данных столбца в качестве левого операнда.

Классы операторов углублённо рассматриваются в Разделе 37.16.

Таблица 51.33. Столбцы pg_opclass

Тип столбца

Описание

oid oid

Идентификатор строки

opcmethod oid (ссылается на pg_am.oid)

Индексный метод доступа, для которого создан этот класс операторов

opcname name

Имя этого класса операторов

opcnamespace oid (ссылается на pg_namespace.oid)

Пространство имён этого класса операторов

opcowner oid (ссылается на pg_authid.oid)

Владелец класса операторов

opcfamily oid (ссылается на pg_opfamily.oid)

Семейство операторов, содержащее этот класс операторов

opcintype oid (ссылается на pg_type.oid)

Тип данных, индексируемый данным классом операторов

opcdefault bool

True, если этот класс операторов применяется по умолчанию для opcintype

opckeytype oid (ссылается на pg_type.oid)

Тип данных, хранимых в индексе, или ноль, если он совпадает с opcintype


Значение opcmethod класса операторов должно совпадать с opfmethod для содержащего его семейства операторов. Кроме того, должно быть не больше одной строки в pg_opclass, в которой opcdefault равно true для любой данной комбинации opcmethod и opcintype.

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

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


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.