DROP_OPERATOR_FAMILY(7pg18)

๐Ÿ“ฆ version 18.6, in opensuse-leap 16.0

โœจ DROP OPERATOR FAMILY โœจ

okay bestie, welcome to DROP_OPERATOR_FAMILY, the PostgreSQL 18.6 page about yeeting an operator family out of existence ๐Ÿ’…


๐ŸŒธ NAME ๐ŸŒธ

DROP_OPERATOR_FAMILY โ€” remove an operator family ๐Ÿซถ


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

DROP OPERATOR FAMILY [ IF EXISTS ] name USING index_method [ CASCADE | RESTRICT ]

๐Ÿ’– DESCRIPTION ๐Ÿ’–

So like, DROP OPERATOR FAMILY drops an existing operator family. Periodt. But heads up bestie โ€” to run this command you must be the owner of the operator family. No ownership, no vibes, no drop. ๐Ÿ”ฅ

And here's the tea ๐Ÿ“: DROP OPERATOR FAMILY includes dropping any operator classes contained in the family, but it does not drop any of the operators or functions referenced by the family. Those stay exactly where they are. If there are any indexes depending on operator classes within the family, you will need to specify CASCADE for the drop to actually complete. Otherwise it's giving "no โค๏ธ".


๐Ÿ‘‘ PARAMETERS ๐Ÿ‘‘

  • IF EXISTS โ€” Do not throw an error if the operator family does not exist. A notice is issued in this case. Like, it's not mad at you, it's just letting you know ๐Ÿ’€
  • name โ€” The name (optionally schema-qualified) of an existing operator family.
  • index_method โ€” The name of the index access method the operator family is for.
  • CASCADE โ€” Automatically drop objects that depend on the operator family, and in turn all objects that depend on those objects (see Section 5.15). It's giving domino effect, and honestly? slay.
  • RESTRICT โ€” Refuse to drop the operator family if any objects depend on it. This is the default. It's the "actually, let's not" of the two.

๐Ÿฆ‹ EXAMPLES ๐Ÿฆ‹

Remove the B-tree operator family float_ops:

DROP OPERATOR FAMILY float_ops USING btree;

This command will not succeed if there are any existing indexes that use operator classes within the family. Add CASCADE to drop such indexes along with the operator family. ๐Ÿ”ฅ

ngl this is the part where people get mad at the error message. it's not broken, bestie, you just gotta commit to the cascade ๐Ÿ˜ญ

๐ŸŒˆ COMPATIBILITY ๐ŸŒˆ

There is no DROP OPERATOR FAMILY statement in the SQL standard. So it's giving very much "Postgres exclusive, iykyk" โœจ


โญ SEE ALSO โญ


and that's the whole page, bestie โ€” go forth and drop responsibly ๐Ÿงš๐Ÿ’œ

This one's from PostgreSQL 18.6, dated 2026, and it's the DROP OPERATOR FAMILY(7) page. mwah ๐Ÿ’‹

๐Ÿ“ฆ where this page comes from