DROP_FOREIGN_DATA_WRAPPER(7pg18)
๐ 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 ๐
CREATE FOREIGN DATA WRAPPER(CREATE_FOREIGN_DATA_WRAPPER(7))ALTER FOREIGN DATA WRAPPER(ALTER_FOREIGN_DATA_WRAPPER(7))
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) ๐ซถ๐
๐ฆ where this page comes from
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms