1<!-- 2doc/src/sgml/ref/drop_foreign_table.sgml 3PostgreSQL documentation 4--> 5 6<refentry id="sql-dropforeigntable"> 7 <indexterm zone="sql-dropforeigntable"> 8 <primary>DROP FOREIGN TABLE</primary> 9 </indexterm> 10 11 <refmeta> 12 <refentrytitle>DROP FOREIGN TABLE</refentrytitle> 13 <manvolnum>7</manvolnum> 14 <refmiscinfo>SQL - Language Statements</refmiscinfo> 15 </refmeta> 16 17 <refnamediv> 18 <refname>DROP FOREIGN TABLE</refname> 19 <refpurpose>remove a foreign table</refpurpose> 20 </refnamediv> 21 22 <refsynopsisdiv> 23<synopsis> 24DROP FOREIGN TABLE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> [, ...] [ CASCADE | RESTRICT ] 25</synopsis> 26 </refsynopsisdiv> 27 28 <refsect1> 29 <title>Description</title> 30 31 <para> 32 <command>DROP FOREIGN TABLE</command> removes a foreign table. 33 Only the owner of a foreign table can remove it. 34 </para> 35 </refsect1> 36 37 <refsect1> 38 <title>Parameters</title> 39 40 <variablelist> 41 <varlistentry> 42 <term><literal>IF EXISTS</literal></term> 43 <listitem> 44 <para> 45 Do not throw an error if the foreign table does not exist. 46 A notice is issued in this case. 47 </para> 48 </listitem> 49 </varlistentry> 50 51 <varlistentry> 52 <term><replaceable class="parameter">name</replaceable></term> 53 <listitem> 54 <para> 55 The name (optionally schema-qualified) of the foreign table to drop. 56 </para> 57 </listitem> 58 </varlistentry> 59 60 <varlistentry> 61 <term><literal>CASCADE</literal></term> 62 <listitem> 63 <para> 64 Automatically drop objects that depend on the foreign table (such as 65 views), and in turn all objects that depend on those objects 66 (see <xref linkend="ddl-depend"/>). 67 </para> 68 </listitem> 69 </varlistentry> 70 71 <varlistentry> 72 <term><literal>RESTRICT</literal></term> 73 <listitem> 74 <para> 75 Refuse to drop the foreign table if any objects depend on it. This is 76 the default. 77 </para> 78 </listitem> 79 </varlistentry> 80 </variablelist> 81 </refsect1> 82 83 <refsect1> 84 <title>Examples</title> 85 86 <para> 87 To destroy two foreign tables, <literal>films</literal> and 88 <literal>distributors</literal>: 89 90<programlisting> 91DROP FOREIGN TABLE films, distributors; 92</programlisting></para> 93 </refsect1> 94 95 <refsect1> 96 <title>Compatibility</title> 97 98 <para> 99 This command conforms to ISO/IEC 9075-9 (SQL/MED), except that the 100 standard only allows one foreign table to be dropped per command, and apart 101 from the <literal>IF EXISTS</literal> option, which is a <productname>PostgreSQL</productname> 102 extension. 103 </para> 104 </refsect1> 105 106 <refsect1> 107 <title>See Also</title> 108 109 <simplelist type="inline"> 110 <member><xref linkend="sql-alterforeigntable"/></member> 111 <member><xref linkend="sql-createforeigntable"/></member> 112 </simplelist> 113 </refsect1> 114 115</refentry> 116