DROP_FOREIGN_TABLE(7pg15)

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

πŸ’– NAME πŸ’–

okay so this is the DROP_FOREIGN_TABLE(7pg15) page from the PostgreSQL 15.19 Documentation, and it is literally all about DROP FOREIGN TABLE β€” the command that removes a foreign table. bestie, only the owner of a foreign table can remove it. no cap. ✨

πŸ¦‹ SYNOPSIS πŸ¦‹

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

🌸 DESCRIPTION 🌸

DROP FOREIGN TABLE removes a foreign table. Only the owner of a foreign table can remove it. that's the whole vibe check πŸ’…

πŸŽ€ PARAMETERS πŸŽ€

  • IF EXISTS β€” do not throw an error if the foreign table does not exist. a notice is issued in this case, so it still lets you know what's up πŸ‘€
  • name β€” the name of the foreign table to drop, optionally schema-qualified. yes bestie, you can be extra specific πŸ’–
  • 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). it's giving chain reaction πŸ”₯
  • RESTRICT β€” refuse to drop the foreign table if any objects depend on it. this is the default, so it's the safe lil default vibe 🫢

πŸ“ EXAMPLES πŸ“

to destroy two foreign tables, films and distributors:

DROP FOREIGN TABLE films, distributors;

πŸ’€ 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 yeah, mostly standard with a lil PostgreSQL flourish ✨

πŸ‘‘ SEE ALSO πŸ‘‘


mwah πŸ’‹ this cutie is PostgreSQL 15.19, dated 2026, and the page is DROP FOREIGN TABLE(7). periodt. 🌈

πŸ“¦ where this page comes from