DROP_FOREIGN_TABLE(7pg16)

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

πŸ’… DROP FOREIGN TABLE β€” the pg16 glow-up πŸ¦‹

okay bestie so you've got a foreign table and you want it gone β€” like, gone gone. This is the PostgreSQL 16.15 documentation for DROP FOREIGN TABLE and I'm gonna walk you through it, no cap. ✨


🌸 NAME 🌸

DROP_FOREIGN_TABLE β€” remove a foreign table. literally just yeet it. πŸ’€


πŸŽ€ SYNOPSIS πŸŽ€

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

that's the whole vibe. very demure, very mindful. 🫢


✨ DESCRIPTION ✨

DROP FOREIGN TABLE removes a foreign table. that's the main character move. but bestie, listen β€” only the owner of a foreign table can remove it. so if it's not yours, hands off. πŸ™ˆ


πŸ’– PARAMETERS πŸ’–

  • IF EXISTS β€” don't throw an error if the foreign table doesn't exist. instead a notice gets issued in this case. like, "hey, it wasn't there anyway, we're fine." 😌
  • name β€” the name of the foreign table to drop. it can be optionally schema-qualified, so you can be all fancy and specific about it. πŸ’…
  • CASCADE β€” automatically drop objects that depend on the foreign table (such as views), and in turn all objects that depend on those objects (see Section 5.14). yes, it cascades. yes, that's a lot of dropping. you've been warned. πŸ”₯
  • RESTRICT β€” refuse to drop the foreign table if any objects depend on it. this one is the default, so if you don't say anything it's gonna be cautious. πŸŽ€

🌈 EXAMPLES 🌈

to destroy two foreign tables, films and distributors:

DROP FOREIGN TABLE films, distributors;

two at once. we love efficiency. πŸ‘‘


🧚 COMPATIBILITY 🧚

this command conforms to ISO/IEC 9075-9 (SQL/MED), except that the standard only allows one foreign table to be dropped per command, and apart from the IF EXISTS option, which is a PostgreSQL extension. so like... mostly standard, a little bit extra. iconic behavior. ⭐


πŸ¦‹ SEE ALSO πŸ¦‹


PostgreSQL 16.15 Β· 2026 Β· DROP FOREIGN TABLE(7)

that's the page bestie, mwah. πŸ’œπŸ’–βœ¨ go forth and drop responsibly. πŸ“

πŸ“¦ where this page comes from