DROP_OPERATOR(7pg16)

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

πŸŽ€ DROP_OPERATOR, but make it cute πŸŽ€

okay bestie, welcome to the DROP_OPERATOR page from the PostgreSQL 16.15 docs πŸ’– this is the command that removes an operator from the database system, and yes it's giving "cleanup era" ✨

✨ NAME ✨

DROP_OPERATOR β€” remove an operator πŸ’…

πŸ¦‹ SYNOPSIS πŸ¦‹

DROP OPERATOR [ IF EXISTS ] name ( { left_type | NONE } , right_type ) [, ...] [ CASCADE | RESTRICT ]

lowkey just look at that syntax, she's iconic 🫢

🌸 DESCRIPTION 🌸

DROP_OPERATOR drops an existing operator from the database system. no cap. To execute this command, you must be the owner of the operator β€” main character permissions only, bestie πŸ‘‘

πŸ’œ PARAMETERS πŸ’œ

  • IF EXISTS β€” do not throw an error if the operator does not exist. a notice is issued in this case, so it's like a gentle little "hmm, not here" πŸ’¬
  • name β€” the name (optionally schema-qualified) of an existing operator.
  • left_type β€” the data type of the operator's left operand; write NONE if the operator has no left operand.
  • right_type β€” the data type of the operator's right operand.
  • CASCADE β€” automatically drop objects that depend on the operator (such as views using it), and in turn all objects that depend on those objects (see Section 5.14). it's giving domino effect, handle with care πŸ’€
  • RESTRICT β€” refuse to drop the operator if any objects depend on it. this is the default, so she's cautious by nature πŸŽ€

πŸ“ EXAMPLES πŸ“

Remove the power operator a^b for type integer:

DROP OPERATOR ^ (integer, integer);

Remove the bitwise-complement prefix operator ~b for type bit:

DROP OPERATOR ~ (none, bit);

Remove multiple operators in one command:

DROP OPERATOR ~ (none, bit), ^ (integer, integer);

ate, no crumbs πŸ”₯

🌈 COMPATIBILITY 🌈

There is no DROP OPERATOR statement in the SQL standard. so this is very much a PostgreSQL-specific slay πŸ’…

πŸ‘‘ SEE ALSO πŸ‘‘

πŸ’– and that's the whole DROP_OPERATOR page, bestie β€” from the PostgreSQL 16.15 docs, dated 2026. now go forth and drop operators responsibly πŸ’…βœ¨
πŸ“¦ where this page comes from