ALTER_OPERATOR_CLASS(7pg15)

πŸ“¦ version 15.19, in opensuse-leap 16.0

🌸 NAME 🌸

okay so this is the ALTER OPERATOR CLASS page, and it’s literally about changing the definition of an operator class. That’s the whole main-character job. πŸ’…

✨ SYNOPSIS ✨

bestie, here’s the exact syntax vibe, no cap:

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. Simple as that, but make it iconic. ✨

ownership check, bestie: you must own the operator class to use ALTER OPERATOR CLASS. To alter the owner, you must also be a direct or indirect member of the new owning role, and that role must have CREATE privilege on the operator class’s schema. Why? because 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. Not a thing. Periodt. πŸ’€

🌈 SEE ALSO 🌈

go peek at these icons too:


mwah πŸ’‹ β€” source/version: PostgreSQL 15.19, date: 2026. bye bestie! 🫢

πŸ“¦ where this page comes from