CREATE_OPERATOR_FAMILY(7pg13)

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

πŸ’… CREATE_OPERATOR_FAMILY πŸ’…

okay so bestie, welcome to the CREATE OPERATOR FAMILY(7) page from the PostgreSQL 13.23 Documentation β€” and yes, she's a whole vibe. let's get into it 🫢


✨ NAME ✨

CREATE_OPERATOR_FAMILY β€” define a new operator family πŸŽ€


🌸 SYNOPSIS 🌸

CREATE OPERATOR FAMILY name USING index_method

that's it. that's the whole git. iconic honestly.


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so CREATE OPERATOR FAMILY creates a new operator family. and what IS an operator family, you ask? πŸ’– it defines a collection of related operator classes β€” and maybe some extra operators and support functions that are compatible with those operator classes but not essential for the functioning of any individual index. like they're cool with everybody, they just don't have a job-job.

(and real talk: operators and functions that ARE essential to indexes should be grouped within the relevant operator class, not left being all "loose" in the operator family. lowkey the rule is β€” typically, single-data-type operators are bound to operator classes, while cross-data-type operators can be loose in an operator family containing operator classes for both data types. iykyk 🧚)

the new operator family is initially empty, no cap. it should be populated by issuing subsequent CREATE OPERATOR CLASS commands to add contained operator classes, and optionally ALTER OPERATOR FAMILY commands to add "loose" operators and their corresponding support functions. build her up, don't leave her empty πŸ’€

if a schema name is given then the operator family is created in the specified schema. otherwise it is created in the current schema. two operator families in the same schema can have the same name only if they are for different index methods. them's the rules bestie πŸ’…

the user who defines an operator family becomes its owner β€” main character energy, you own what you make πŸ‘‘. presently, the creating user must be a superuser. (and this restriction is made because an erroneous operator family definition could confuse or even crash the server. like... crash. the whole server. 😭 not cute. do not play with this.)

refer to Section 37.16 for further information 🌈


πŸ“ PARAMETERS πŸ“

  • name β€” the name of the operator family to be created. the name can be schema-qualified ✨
  • index_method β€” the name of the index method this operator family is for 🎯

⭐ COMPATIBILITY ⭐

CREATE OPERATOR FAMILY is a PostgreSQL extension. there is no CREATE OPERATOR FAMILY statement in the SQL standard. we're just built different, periodt πŸ’…πŸ”₯


πŸ’œ SEE ALSO πŸ’œ

  • ALTER OPERATOR FAMILY (ALTER_OPERATOR_FAMILY(7))
  • DROP OPERATOR FAMILY (DROP_OPERATOR_FAMILY(7))
  • CREATE OPERATOR CLASS (CREATE_OPERATOR_CLASS(7))
  • ALTER OPERATOR CLASS (ALTER_OPERATOR_CLASS(7))
  • DROP OPERATOR CLASS (DROP_OPERATOR_CLASS(7))

go read those too, bestie, they all ate πŸ’–


and that's the page!! brought to you by PostgreSQL 13.23, dated 2025 β€” mwah, love u, go make some operator families πŸ§šβ€β™€οΈπŸ’…πŸ«Ά

πŸ“¦ where this page comes from