{"Entry":{"collection":"sql","key":"drop-foreign-table","name":"DROP FOREIGN TABLE","aliases":["dropforeigntable"],"metadata":{"aliases":["dropforeigntable"],"changed_in":[],"changes":[{"from":"9.0","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"added","synopsis":null,"to":"9.1"},{"from":"9.5","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters"],"removed":[]},"status":"changed","synopsis":null,"to":"9.6"},{"from":"11","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters"],"removed":[]},"status":"changed","synopsis":null,"to":"12"},{"from":"12","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["compatibility"],"removed":[]},"status":"changed","synopsis":null,"to":"13"},{"from":"16","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters"],"removed":[]},"status":"changed","synopsis":null,"to":"17"},{"from":"18","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters"],"removed":[]},"status":"changed","synopsis":null,"to":"19"}],"content_hash":"3ec1fa92c4c58f1fcf004d120c412801a9d7cedba7f1e9f7d2d0714b4fa841df","derived_content_hash":"84f5bd46dc241fde36790169bf0e2eb8f42d1682fb70e7734e4d088ef99809b4","editorial":{},"first_version":"9.1","group":"foreign","imported_at":"2026-09-30T17:43:38.820903+08:00","last_version":"20","name":"DROP FOREIGN TABLE","object":"FOREIGN TABLE","position":9006,"present_in":["9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"purpose":"remove a foreign table","purpose_zh":"","related":["alter-foreign-table","create-foreign-table"],"repair_provenance":{"original_source_revision":"wiki-repair-20261023:5a5938fc5a97993be57e5b3972d6eb615f58b995f0f99a5a0e077827c9e4f6a1","receipt_sha256":"d134c62f5483257a8d0591ebc8d12419bfd5990a000b277901c945f53aff1087","repair":"wiki-repair-20261023"},"slug":"drop-foreign-table","source_rev":"wiki-repair-20261023:f6de544085bbff08affdfb16c7243c1cb7e9e1117d3a5b4bf6cad40f037231ae","synopsis":"DROP FOREIGN TABLE [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]","verb":"DROP"}},"Definition":{"Collection":"sql","Key":"drop-foreign-table","SourceDatabase":"center","Version":"18","SourceTable":"sqlcmd","SourceKey":"drop-foreign-table","SourceRevision":"wiki-repair-20261023:f6de544085bbff08affdfb16c7243c1cb7e9e1117d3a5b4bf6cad40f037231ae","Facts":{"anchor":"SQL-DROPFOREIGNTABLE","description_zh":"移除一个外部表","description_zh_html":"\u003cpre\u003eDROP FOREIGN TABLE [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]\u003c/pre\u003e\u003csection\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003eDROP FOREIGN TABLE\u003c/code\u003e 移除一个外部表。只有外部表的拥有者才能移除它。\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e参数\u003c/h2\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eIF EXISTS\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      如果该外部表不存在，则不要抛出错误。这种情况下会发出一个提示。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      要删除的外部表名称（可以被模式限定）。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      自动删除依赖于该外部表的对象（例如视图），以及进一步依赖于这些对象的所有对象（参见\u003ca class=\"xref\" href=\"/zh/docs/18/ddl-depend.html\" title=\"5.15. 依赖跟踪\"\u003e第 5.15 节\u003c/a\u003e）。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eRESTRICT\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      如果有任何对象依赖于该外部表，则拒绝删除它。这是默认值。\n     \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e示例\u003c/h2\u003e\u003cp\u003e\n   要销毁两个外部表 \u003ccode class=\"literal\"\u003efilms\u003c/code\u003e 和 \u003ccode class=\"literal\"\u003edistributors\u003c/code\u003e：\n\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\nDROP FOREIGN TABLE films, distributors;\n\u003c/pre\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e兼容性\u003c/h2\u003e\u003cp\u003e\n   此命令符合 ISO/IEC 9075-9（SQL/MED），但标准每条命令只允许删除一个外部表，而 \u003ccode class=\"literal\"\u003eIF EXISTS\u003c/code\u003e 选项是 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 扩展。\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e另见\u003c/h2\u003e\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/zh/docs/18/sql-alterforeigntable.html\" title=\"ALTER FOREIGN TABLE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER FOREIGN TABLE\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/zh/docs/18/sql-createforeigntable.html\" title=\"CREATE FOREIGN TABLE\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE FOREIGN TABLE\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/section\u003e","file":"sql-dropforeigntable.html","lang":"en","name":"DROP FOREIGN TABLE","purpose":"remove a foreign table","purpose_zh":"移除一个外部表","related":["alter-foreign-table","create-foreign-table"],"sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eDROP FOREIGN TABLE\u003c/code\u003e removes a foreign table. Only the owner of a foreign table can remove it.\u003c/p\u003e","key":"description","title":"Description"},{"html":"\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eIF EXISTS\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eDo not throw an error if the foreign table does not exist. A notice is issued in this case.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name (optionally schema-qualified) of the foreign table to drop.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eAutomatically drop objects that depend on the foreign table (such as views), and in turn all objects that depend on those objects (see \u003ca href=\"/docs/18/ddl-depend.html\" title=\"5.15. Dependency Tracking\"\u003eSection 5.15\u003c/a\u003e).\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eRESTRICT\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eRefuse to drop the foreign table if any objects depend on it. This is the default.\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","key":"parameters","title":"Parameters"},{"html":"\u003cp\u003eTo destroy two foreign tables, \u003ccode class=\"literal\"\u003efilms\u003c/code\u003e and \u003ccode class=\"literal\"\u003edistributors\u003c/code\u003e:\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eDROP FOREIGN TABLE films, distributors;\n\u003c/pre\u003e","key":"examples","title":"Examples"},{"html":"\u003cp\u003eThis 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 \u003ccode class=\"literal\"\u003eIF EXISTS\u003c/code\u003e option, which is a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e extension.\u003c/p\u003e","key":"compatibility","title":"Compatibility"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/alter-foreign-table/?v=18\" title=\"ALTER FOREIGN TABLE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER FOREIGN TABLE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/create-foreign-table/?v=18\" title=\"CREATE FOREIGN TABLE\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE FOREIGN TABLE\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","slug":"18","synopsis_html":"DROP FOREIGN TABLE [ IF EXISTS ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e [, ...] [ CASCADE | RESTRICT ]","synopsis_text":"DROP FOREIGN TABLE [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]","translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/sql-dropforeigntable.html","sha256":"7da210f1f6dd74d9ade958d6ab85aa9ed8b49327e9726248709d08b3fae0af1c"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"zh_from":"same-version-pgdoc"},"ManualEvidence":{},"MeasuredEvidence":{}},"Text":{"Collection":"sql","Key":"drop-foreign-table","SourceDatabase":"center","Version":"18","Locale":"en","Title":"DROP FOREIGN TABLE","Summary":"remove a foreign table","BodyHTML":"\u003cpre\u003eDROP FOREIGN TABLE [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]\u003c/pre\u003e\u003csection\u003e\u003ch2\u003eDescription\u003c/h2\u003e\u003cp\u003e\u003ccode\u003eDROP FOREIGN TABLE\u003c/code\u003e removes a foreign table. Only the owner of a foreign table can remove it.\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eParameters\u003c/h2\u003e\u003cdiv\u003e\u003cdl\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003eIF EXISTS\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eDo not throw an error if the foreign table does not exist. A notice is issued in this case.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name (optionally schema-qualified) of the foreign table to drop.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003eCASCADE\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eAutomatically drop objects that depend on the foreign table (such as views), and in turn all objects that depend on those objects (see \u003ca href=\"/docs/18/ddl-depend.html\" rel=\"nofollow\"\u003eSection 5.15\u003c/a\u003e).\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003eRESTRICT\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eRefuse to drop the foreign table if any objects depend on it. This is the default.\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eExamples\u003c/h2\u003e\u003cp\u003eTo destroy two foreign tables, \u003ccode\u003efilms\u003c/code\u003e and \u003ccode\u003edistributors\u003c/code\u003e:\u003c/p\u003e\u003cpre\u003eDROP FOREIGN TABLE films, distributors;\n\u003c/pre\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eCompatibility\u003c/h2\u003e\u003cp\u003eThis 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 \u003ccode\u003eIF EXISTS\u003c/code\u003e option, which is a \u003cspan\u003ePostgreSQL\u003c/span\u003e extension.\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan\u003e\u003ca href=\"/wiki/sql/alter-foreign-table/?v=18\" title=\"ALTER FOREIGN TABLE\" rel=\"nofollow\"\u003e\u003cspan\u003eALTER FOREIGN TABLE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/create-foreign-table/?v=18\" title=\"CREATE FOREIGN TABLE\" rel=\"nofollow\"\u003e\u003cspan\u003eCREATE FOREIGN TABLE\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/section\u003e","SourceRevision":"wiki-repair-20261023:f6de544085bbff08affdfb16c7243c1cb7e9e1117d3a5b4bf6cad40f037231ae","ContentHash":"00ab94de7f33fd7b2efdeae599c1650d898ec30959a6d18a7547756a5c0be38a","Payload":{"related":["alter-foreign-table","create-foreign-table"],"sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eDROP FOREIGN TABLE\u003c/code\u003e removes a foreign table. Only the owner of a foreign table can remove it.\u003c/p\u003e","key":"description","title":"Description"},{"html":"\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eIF EXISTS\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eDo not throw an error if the foreign table does not exist. A notice is issued in this case.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name (optionally schema-qualified) of the foreign table to drop.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eAutomatically drop objects that depend on the foreign table (such as views), and in turn all objects that depend on those objects (see \u003ca href=\"/docs/18/ddl-depend.html\" title=\"5.15. Dependency Tracking\"\u003eSection 5.15\u003c/a\u003e).\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eRESTRICT\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eRefuse to drop the foreign table if any objects depend on it. This is the default.\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","key":"parameters","title":"Parameters"},{"html":"\u003cp\u003eTo destroy two foreign tables, \u003ccode class=\"literal\"\u003efilms\u003c/code\u003e and \u003ccode class=\"literal\"\u003edistributors\u003c/code\u003e:\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eDROP FOREIGN TABLE films, distributors;\n\u003c/pre\u003e","key":"examples","title":"Examples"},{"html":"\u003cp\u003eThis 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 \u003ccode class=\"literal\"\u003eIF EXISTS\u003c/code\u003e option, which is a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e extension.\u003c/p\u003e","key":"compatibility","title":"Compatibility"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/alter-foreign-table/?v=18\" title=\"ALTER FOREIGN TABLE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER FOREIGN TABLE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/create-foreign-table/?v=18\" title=\"CREATE FOREIGN TABLE\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE FOREIGN TABLE\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","synopsis_html":"DROP FOREIGN TABLE [ IF EXISTS ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e [, ...] [ CASCADE | RESTRICT ]","synopsis_text":"DROP FOREIGN TABLE [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]"}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
