DROP FOREIGN TABLE
Updated at:
Removes one or more foreign tables from the current database.
Syntax
DROP FOREIGN TABLE [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
Parameters
|
Parameter |
Description |
|
|
Suppresses an error if the table does not exist. A notice is issued instead. Use this option in scripts to make the statement idempotent. |
|
|
The name of the foreign table to drop. To drop multiple tables in a single statement, provide a comma-separated list of names. |
|
|
Automatically drops objects that depend on the foreign table. |
|
|
Refuses to drop the foreign table if any objects depend on it. This is the default behavior. |
Examples
Drop a foreign table
DROP FOREIGN TABLE holo_test;
Drop a foreign table only if it exists
Use IF EXISTS to avoid an error when the table may not exist, for example, in a setup or cleanup script.
DROP FOREIGN TABLE IF EXISTS holo_test;
Drop multiple foreign tables
DROP FOREIGN TABLE holo_test, holo_orders;
Drop a foreign table and its dependent objects
Use CASCADE to drop a foreign table together with any views or other objects that depend on it.
DROP FOREIGN TABLE holo_test CASCADE;
Is this page helpful?