DROP_OPERATOR_FAMILY(7pg13)
π DROP OPERATOR FAMILY π
Okay so bestie, welcome to the glow-up guide for DROP OPERATOR FAMILY β this is the PostgreSQL 13 move where you literally just yeet an operator family out of existence. Periodt.
β¨ 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. That's the whole vibe. But heads up β to run this command you must be the owner of the operator family. No borrowing your friend's credentials, bestie. π
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. So those little guys stay living their best life. π¦
Also, if there are any indexes depending on operator classes within the family, you will need to specify CASCADE for the drop to complete. Like, it's giving "I can't do this alone" energy. π
π¦ PARAMETERS π¦
IF EXISTSβ Do not throw an error if the operator family does not exist. A notice is issued in this case. Basically: if it's not there, we just move on gracefully. πββοΈnameβ The name (optionally schema-qualified) of an existing operator family. You know, its whole identity. πindex_methodβ The name of the index access method the operator family is for. Likebtree,hash, etc. β every family has its method, iykyk. π₯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 the domino effect, bestie β once one falls, they all fall. πRESTRICTβ Refuse to drop the operator family if any objects depend on it. This is the default. So if you're not sure, it's lowkey protecting you. π‘οΈ
π EXAMPLES π
Remove the B-tree operator family float_ops:
DROP OPERATOR FAMILY float_ops USING btree;
Now listen β 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. So if you're getting errors, that's why. Not me forgetting, it's literally in the docs. π
π§ COMPATIBILITY π§
There is no DROP OPERATOR FAMILY statement in the SQL standard. So like, we're built different. PostgreSQL said "I'll make my own rules." π
π SEE ALSO π
ALTER OPERATOR FAMILY(ALTER_OPERATOR_FAMILY(7)) β change it upCREATE OPERATOR FAMILY(CREATE_OPERATOR_FAMILY(7)) β make a new oneALTER OPERATOR CLASS(ALTER_OPERATOR_CLASS(7)) β tweak the classCREATE OPERATOR CLASS(CREATE_OPERATOR_CLASS(7)) β new class energyDROP OPERATOR CLASS(DROP_OPERATOR_CLASS(7)) β drop the class too
That's the whole main character moment, bestie. This guide is from PostgreSQL 13.23 and it's dated 2025 β literally iconic. Go drop those operator families responsibly. Slay. β¨π«ΆπΈ
π¦ where this page comes from
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-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