All Products
Search
Document Center

PolarDB:CREATE OPERATOR FAMILY

Last Updated:Mar 28, 2026

CREATE OPERATOR FAMILY creates a new operator family.

Description

An operator family defines a collection of related operator classes, and optionally additional operators and support functions that are compatible with those operator classes but not essential to any individual index. Operators and functions that are essential to an index belong in the operator class itself rather than loose in the operator family. Single-data-type operators typically bind to operator classes, while cross-data-type operators can sit loose in an operator family that contains operator classes for both data types.

A newly created operator family is empty. Populate it by issuing CREATE OPERATOR CLASS commands to add operator classes, and optionally ALTER OPERATOR FAMILY commands to add loose operators and their support functions.

If a schema name is provided, the operator family is created in that schema. Otherwise, it is created in the current schema. Two operator families in the same schema can share a name only if they target different index methods.

The user who defines an operator family becomes its owner. Presently, the creating user must be a superuser, because an erroneous operator family definition can confuse or crash the server.

Synopsis

CREATE OPERATOR FAMILY name USING index_method

Parameters

ParameterDescription
nameThe name of the operator family to create. The name can be schema-qualified.
index_methodThe name of the index method this operator family is for.

What's next

After creating the operator family, add content to it:

  • Run CREATE OPERATOR CLASS to add operator classes to the family.

  • Run ALTER OPERATOR FAMILY to add loose operators and support functions.

See also

  • ALTER OPERATOR FAMILY

  • CREATE OPERATOR CLASS