1<!-- 2doc/src/sgml/ref/drop_type.sgml 3PostgreSQL documentation 4--> 5 6<refentry id="sql-droptype"> 7 <indexterm zone="sql-droptype"> 8 <primary>DROP TYPE</primary> 9 </indexterm> 10 11 <refmeta> 12 <refentrytitle>DROP TYPE</refentrytitle> 13 <manvolnum>7</manvolnum> 14 <refmiscinfo>SQL - Language Statements</refmiscinfo> 15 </refmeta> 16 17 <refnamediv> 18 <refname>DROP TYPE</refname> 19 <refpurpose>remove a data type</refpurpose> 20 </refnamediv> 21 22 <refsynopsisdiv> 23<synopsis> 24DROP TYPE [ 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 TYPE</command> removes a user-defined data type. 33 Only the owner of a type 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 type does not exist. A notice is issued 46 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 data type to remove. 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 type (such as 65 table columns, functions, and operators), 66 and in turn all objects that depend on those objects 67 (see <xref linkend="ddl-depend"/>). 68 </para> 69 </listitem> 70 </varlistentry> 71 72 <varlistentry> 73 <term><literal>RESTRICT</literal></term> 74 <listitem> 75 <para> 76 Refuse to drop the type if any objects depend on it. This is 77 the default. 78 </para> 79 </listitem> 80 </varlistentry> 81 </variablelist> 82 </refsect1> 83 84 <refsect1 id="sql-droptype-examples"> 85 <title>Examples</title> 86 87 <para> 88 To remove the data type <type>box</type>: 89<programlisting> 90DROP TYPE box; 91</programlisting></para> 92 </refsect1> 93 94 <refsect1 id="sql-droptype-compatibility"> 95 <title>Compatibility</title> 96 97 <para> 98 This command is similar to the corresponding command in the SQL 99 standard, apart from the <literal>IF EXISTS</literal> 100 option, which is a <productname>PostgreSQL</productname> extension. 101 But note that much of the <command>CREATE TYPE</command> command 102 and the data type extension mechanisms in 103 <productname>PostgreSQL</productname> differ from the SQL standard. 104 </para> 105 </refsect1> 106 107 <refsect1 id="sql-droptype-see-also"> 108 <title>See Also</title> 109 110 <simplelist type="inline"> 111 <member><xref linkend="sql-altertype"/></member> 112 <member><xref linkend="sql-createtype"/></member> 113 </simplelist> 114 </refsect1> 115 116</refentry> 117