DROP_FOREIGN_DATA_WRAPPER(7)

๐Ÿ’… DROP_FOREIGN_DATA_WRAPPER ๐Ÿ’…

okay bestie, welcome to the DROP_FOREIGN_DATA_WRAPPER(7) page from the PostgreSQL 18.6 Documentation โœจ this is the one where we say bye-bye to a foreign-data wrapper. no cap.


โœจ NAME โœจ

DROP_FOREIGN_DATA_WRAPPER โ€” remove a foreign-data wrapper ๐Ÿซถ like, yeet it. respectfully.


๐ŸŒธ SYNOPSIS ๐ŸŒธ

DROP FOREIGN DATA WRAPPER [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]

look at her. she's gorgeous. she's also very literal, so type it exactly bestie ๐Ÿ’–


๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

DROP FOREIGN DATA WRAPPER removes an existing foreign-data wrapper. that's it, that's the whole vibe. ๐Ÿ’€

but listen โ€” to execute this command, the current user must be the owner of the foreign-data wrapper. not your friend, not your group chat, you. owner energy only, no borrowing. ๐Ÿ‘‘


๐ŸŽ€ PARAMETERS ๐ŸŽ€

  • IF EXISTS โ€” do not throw an error if the foreign-data wrapper does not exist. instead a notice is issued in this case. so it's giving "no drama, just a little heads up" ๐ŸŒˆ
  • name โ€” the name of an existing foreign-data wrapper. the actual thing you're dropping, bestie. โœจ
  • CASCADE โ€” automatically drop objects that depend on the foreign-data wrapper (such as foreign tables and servers), and in turn all objects that depend on those objects (see Section 5.15). this is the dramatic one โ€” it takes the whole friend group down with it. ๐Ÿ˜ญ๐Ÿ”ฅ
  • RESTRICT โ€” refuse to drop the foreign-data wrapper if any objects depend on it. this is the default. protective, cautious, lowkey the responsible main character. ๐Ÿงš

๐Ÿ“ EXAMPLES ๐Ÿ“

drop the foreign-data wrapper dbi:

DROP FOREIGN DATA WRAPPER dbi;

so clean. so simple. ate. ๐Ÿ’…


๐Ÿ‘‘ COMPATIBILITY ๐Ÿ‘‘

DROP FOREIGN DATA WRAPPER conforms to ISO/IEC 9075-9 (SQL/MED). โญ standard behaviour, we love to see it.

the IF EXISTS clause is a PostgreSQL extension. i.e. that part is our little extra, iykyk. ๐Ÿ™ˆ


๐Ÿ’œ SEE ALSO ๐Ÿ’œ

go read those next, bestie, the trilogy is real ๐Ÿ“šโœจ


reminder fr fr: you gotta own the wrapper to drop the wrapper. and RESTRICT is the default, so if stuff depends on it, she will simply refuse. ๐Ÿ’€ plan accordingly.

and that's the page!! PostgreSQL 18.6, dated 2026 ๐ŸŽ€ mwah, thanks for reading bestie, go drop something (a foreign-data wrapper, specifically) ๐Ÿซถ๐Ÿ’–