RefLib

Reference library for AI

Back

postgresql_16:7.1.71.2 Parameters

PostgreSQL 16 > Reference > SQL Commands > CREATE OPERATOR CLASS > Parameters

*name*

The name of the operator class to be created. The name can be schema-qualified.

DEFAULT

If present, the operator class will become the default operator class for its data type. At most one operator class can be the default for a specific data type and index method.

*data_type*

The column data type that this operator class is for.

*index_method*

The name of the index method this operator class is for.

*family_name*

The name of the existing operator family to add this operator class to. If not specified, a family named the same as the operator class is used (creating it, if it doesn't already exist).

*strategy_number*

The index method's strategy number for an operator associated with the operator class.

*operator_name*

The name (optionally schema-qualified) of an operator associated with the operator class.

*op_type*

In an OPERATOR clause, the operand data type(s) of the operator, or NONE to signify a prefix operator. The operand data types can be omitted in the normal case where they are the same as the operator class's data type.

In a FUNCTION clause, the operand data type(s) the function is intended to support, if different from the input data type(s) of the function (for B-tree comparison functions and hash functions) or the class's data type (for B-tree sort support functions, B-tree equal image functions, and all functions in GiST, SP-GiST, GIN and BRIN operator classes). These defaults are correct, and so *op_type* need not be specified in FUNCTION clauses, except for the case of a B-tree sort support function that is meant to support cross-data-type comparisons.

*sort_family_name*

The name (optionally schema-qualified) of an existing btree operator family that describes the sort ordering associated with an ordering operator.

If neither FOR SEARCH nor FOR ORDER BY is specified, FOR SEARCH is the default.

*support_number*

The index method's support function number for a function associated with the operator class.

*function_name*

The name (optionally schema-qualified) of a function that is an index method support function for the operator class.

*argument_type*

The parameter data type(s) of the function.

*storage_type*

The data type actually stored in the index. Normally this is the same as the column data type, but some index methods (currently GiST, GIN, SP-GiST and BRIN) allow it to be different. The STORAGE clause must be omitted unless the index method allows a different type to be used. If the column *data_type* is specified as anyarray, the *storage_type* can be declared as anyelement to indicate that the index entries are members of the element type belonging to the actual array type that each particular index is created for.

The OPERATOR, FUNCTION, and STORAGE clauses can appear in any order.

Back