ALTER_OPERATOR_CLASS(7pg13)
π ALTER OPERATOR CLASS(7) β like, the whole glow-up page π¦
okay bestie, so this is the PostgreSQL 13.23 documentation page for ALTER OPERATOR CLASS, and we are literally about to make an operator class's whole definition get a makeover β¨
πΈ NAME πΈ
ALTER OPERATOR_CLASS β change the definition of an operator class. that's it, that's the vibe π
β¨ SYNOPSIS β¨
three separate forms, periodt. here they are, exactly as they live:
ALTER OPERATOR CLASS name USING index_method
RENAME TO new_name
ALTER OPERATOR CLASS name USING index_method
OWNER TO { new_owner | 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. main character behaviour honestly π
now the rules, and yes you need to hear them: you must own the operator class to use ALTER OPERATOR CLASS. fr fr, no ownership no entry π
ββοΈ
and to alter the owner? you also have to be a direct or indirect member of the new owning role, and that role has to 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. so it's like, a safety rail π however, a superuser can alter ownership of any operator class anyway. superusers stay winning π)
π PARAMETERS π
nameβ the name (optionally schema-qualified) of an existing operator class. iykyk π«Άindex_methodβ the name of the index method this operator class is for. like, which index method it belongs to, bestie π₯new_nameβ the new name of the operator class. the rebrand β¨new_ownerβ the new owner of the operator class. handing over the keys πnew_schemaβ the new schema for the operator class. moving day π¦
π COMPATIBILITY π
there is no ALTER OPERATOR CLASS statement in the SQL standard. not a single crumb. the standard simply did not serve here π
β SEE ALSO β
CREATE OPERATOR CLASS(CREATE_OPERATOR_CLASS(7))DROP OPERATOR CLASS(DROP_OPERATOR_CLASS(7))ALTER OPERATOR FAMILY(ALTER_OPERATOR_FAMILY(7))
π
go forth and rename/own/schema-shift responsibly, bestie β and remember, every single one of these three forms needs USING index_method. no cap.
so yeah, that's the page π this was PostgreSQL 13.23, dated 2025, filed under ALTER OPERATOR CLASS(7) β mwah, slay, bye ππ¦πΈ
π¦ where this page comes from
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms