DROP_OPERATOR_FAMILY(7pg15)
π DROP OPERATOR_FAMILY π
okay bestie, this is the DROP OPERATOR FAMILY page from the PostgreSQL 15.19 docs β yes, that one. buckle up, it's actually short and slay. π
β¨ SYNOPSIS β¨
DROP OPERATOR FAMILY [ IF EXISTS ] name USING index_method [ CASCADE | RESTRICT ]
lowkey the whole syntax in one line, we love an efficient queen. π
πΈ DESCRIPTION πΈ
DROP OPERATOR FAMILY drops an existing operator family. that's the whole vibe. but listen β to actually run this command you must be the owner of the operator family, so no sneaking in, bestie. π
here's the tea though: DROP OPERATOR FAMILY does include 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, they're not the problem here. π
and if there are any indexes depending on operator classes within the family? you will need to specify CASCADE for the drop to complete. no CASCADE, no drop, fr fr. π«Ά
π¦ PARAMETERS π¦
IF EXISTSβ do not throw an error if the operator family does not exist. a notice is issued in this case instead. it's giving "no drama, just a heads up". π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.14). it's a whole chain reaction, main character energy. π₯RESTRICTβ refuse to drop the operator family if any objects depend on it. this is the default, so if you do nothing, it's a no. π
π EXAMPLES π
remove the B-tree operator family float_ops, iconic name btw:
DROP OPERATOR FAMILY float_ops USING btree;
okay but heads up β 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. your choice, but choose wisely bestie. π
π COMPATIBILITY π
there is no DROP OPERATOR FAMILY statement in the SQL standard. so like... this is a PostgreSQL original. periodt. π
π 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))
go read those too, iykyk π§
that's the whole page, no cap. this was PostgreSQL 15.19, dated 2026 β DROP OPERATOR FAMILY(7) β and yes i will be thinking about that CASCADE warning all day. slay safe out there! πβ¨π
π¦ where this page comes from
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-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