↑↓ select↵ open⌫ change scopeOpen full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Wiki / SQL Commands

ALTER OPERATOR CLASS

change the definition of an operator class

English manual coverage begins with PostgreSQL 6.4. Source history and runtime observations have their own recorded version boundaries.

Reading PG 18·Select a recorded version

anchor
SQL-ALTEROPCLASS
file
sql-alteropclass.html
lang
en
name
ALTER OPERATOR CLASS
purpose
change the definition of an operator class
purpose zh
更改一个操作符类的定义
sections same as
Unknown
slug
18

Syntax

ALTER OPERATOR CLASS name USING index_method
RENAME TO new_name

ALTER OPERATOR CLASS name USING index_method
OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }

ALTER OPERATOR CLASS name USING index_method
SET SCHEMA new_schema
Syntax diagrams

Read left to right. Branches are choices, bypasses are optional, loops repeat. Select an underlined parameter to open its rule.

ALTER OPERATOR CLASS name USING index_method RENAME TO new_name
ALTER OPERATOR CLASS · Syntax 2
ALTER OPERATOR CLASS name USING index_method OWNER TO new_owner CURRENT_ROLE CURRENT_USER SESSION_USER
ALTER OPERATOR CLASS · Syntax 3
ALTER OPERATOR CLASS name USING index_method SET SCHEMA new_schema

Definition PG 18

ALTER OPERATOR CLASS name USING index_method
RENAME TO new_name

ALTER OPERATOR CLASS name USING index_method
OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }

ALTER OPERATOR CLASS name USING index_method
SET SCHEMA new_schema

Description

ALTER OPERATOR CLASS changes the definition of an operator class.

You must own the operator class to use ALTER OPERATOR CLASS. To alter the owner, you must be able to SET ROLE to the new owning role, and that role must have CREATE privilege on the operator class's schema. (These restrictions enforce that altering the owner doesn't do anything you couldn't do by dropping and recreating the operator class. However, a superuser can alter ownership of any operator class anyway.)

Parameters

name

The name (optionally schema-qualified) of an existing operator class.

index_method

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

new_name

The new name of the operator class.

new_owner

The new owner of the operator class.

new_schema

The new schema for the operator class.

Compatibility

There is no ALTER OPERATOR CLASS statement in the SQL standard.

See Also

CREATE OPERATOR CLASS, DROP OPERATOR CLASS, ALTER OPERATOR FAMILY

Compare versions

Complete source facts

synopsis html

ALTER OPERATOR CLASS <em class="replaceable"><code>name</code></em> USING <em class="replaceable"><code>index_method</code></em>
    RENAME TO <em class="replaceable"><code>new_name</code></em>

ALTER OPERATOR CLASS <em class="replaceable"><code>name</code></em> USING <em class="replaceable"><code>index_method</code></em>
    OWNER TO { <em class="replaceable"><code>new_owner</code></em> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }

ALTER OPERATOR CLASS <em class="replaceable"><code>name</code></em> USING <em class="replaceable"><code>index_method</code></em>
    SET SCHEMA <em class="replaceable"><code>new_schema</code></em>

synopsis text

ALTER OPERATOR CLASS name USING index_method
RENAME TO new_name

ALTER OPERATOR CLASS name USING index_method
OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }

ALTER OPERATOR CLASS name USING index_method
SET SCHEMA new_schema

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · wiki-repair-20261023:7fd9b7d3f5d2b39e91272671636cb2f3906074c240e366c9a5cca202b7d7b508

Text language: en · wiki-repair-20261023:7fd9b7d3f5d2b39e91272671636cb2f3906074c240e366c9a5cca202b7d7b508