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