DROP_OPERATOR_FAMILY(7)
โจ 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 โญ
ALTER OPERATOR FAMILY(ALTER_OPERATOR_FAMILY(7))CREATE OPERATOR FAMILY(CREATE_OPERATOR_FAMILY(7))ALTER OPERATOR CLASS(ALTER_OPERATOR_CLASS(7))CREATE OPERATOR CLASS(CREATE_OPERATOR_CLASS(7))DROP OPERATOR CLASS(DROP_OPERATOR_CLASS(7))
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
- alpine 3.23: postgresql18-doc 18.6-r0 ยท PostgreSQL
- alpine 3.24: postgresql18-doc 18.6-r0 ยท PostgreSQL
- arch rolling: postgresql 18.6-4 ยท PostgreSQL
- fedora 43: postgresql 18.6-1.fc43 ยท PostgreSQL
- fedora 43: postgresql 18.6-1.fc43 ยท PostgreSQL
- fedora 44: postgresql 18.6-1.fc44 ยท PostgreSQL
- fedora 44: postgresql 18.6-1.fc44 ยท PostgreSQL
- nixos 26.05: postgresql 18.6
- ubuntu resolute: postgresql-client-18 18.6-0ubuntu0.26.04.1 ยท PostgreSQL
- ubuntu stonking: postgresql-client-18 18.6-3build2 ยท PostgreSQL
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms