<!--
$Header: /home/postgres/cvs_root/pgsql-r-v7.2/doc/src/sgml/ref/drop_type.sgml,v 1.1.1.1 2002/02/07 17:50:40 bpalmer Exp $
PostgreSQL documentation
-->

<refentry id="SQL-DROPTYPE">
 <refmeta>
  <refentrytitle id="SQL-DROPTYPE-TITLE">
   DROP TYPE
  </refentrytitle>
  <refmiscinfo>SQL - Language Statements</refmiscinfo>
 </refmeta>
 <refnamediv>
  <refname>
   DROP TYPE
  </refname>
  <refpurpose>
   remove a user-defined data type
  </refpurpose>
 </refnamediv>
 <refsynopsisdiv>
  <refsynopsisdivinfo>
   <date>1999-07-20</date>
  </refsynopsisdivinfo>
  <synopsis>
DROP TYPE <replaceable class="PARAMETER">typename</replaceable> [, ...]
  </synopsis>
  
  <refsect2 id="R2-SQL-DROPTYPE-1">
   <refsect2info>
    <date>1998-09-22</date>
   </refsect2info>
   <title>
    Inputs
   </title>
   <para>
    <variablelist>
     <varlistentry>
      <term><replaceable class="PARAMETER">typename</replaceable></term>
      <listitem>
       <para>
	The name of an existing type.
       </para>
      </listitem>
     </varlistentry>
    </variablelist>
   </para>
  </refsect2>

  <refsect2 id="R2-SQL-DROPTYPE-2">
   <refsect2info>
    <date>1998-09-22</date>
   </refsect2info>
   <title>
    Outputs
   </title>
   <para>
    <variablelist>
     <varlistentry>
      <term><computeroutput>
DROP
       </computeroutput></term>
      <listitem>
       <para>
	The message returned if the command is successful.
       </para>
      </listitem>
     </varlistentry>
     <varlistentry>
      <term><computeroutput>
ERROR:  RemoveType: type '<replaceable class="parameter">typename</replaceable>' does not exist
       </computeroutput></term>
      <listitem>
       <para>
	This message occurs if the specified type is not found.
       </para>
      </listitem>
     </varlistentry>
    </variablelist>
   </para>
  </refsect2>
 </refsynopsisdiv>

 <refsect1 id="R1-SQL-DROPTYPE-1">
  <refsect1info>
   <date>1998-09-22</date>
  </refsect1info>
  <title>
   Description
  </title>
  <para>
   <command>DROP TYPE</command> will remove a user type from the
   system catalogs.
  </para>
  <para>
   Only the owner of a type can remove it.
  </para>
 </refsect1>

 <refsect1 id="SQL-DROPTYPE-notes">
  <title>Notes</title>

  <itemizedlist>
   <listitem>
    <para>
     It is the user's responsibility to remove any operators,
     functions, aggregates, access methods, subtypes, and tables that
     use a deleted type.  However, the associated array data type
     (which was automatically created by <command>CREATE TYPE</command>)
     will be removed automatically.
    </para>
   </listitem>

   <listitem>
    <para>
     If a built-in type is removed, the behavior of the server is
     unpredictable.
    </para>
   </listitem>
  </itemizedlist>
 </refsect1>
  
 <refsect1 id="SQL-DROPTYPE-examples">
  <title>Examples</title>
  <para>
   To remove the <type>box</type> type:

<programlisting>
DROP TYPE box;
</programlisting>
  </para>
 </refsect1>

 <refsect1 id="SQL-DROPTYPE-compatibility">
  <title>Compatibility</title>

  <para>
   A <command>DROP TYPE</command> statement exists in SQL99.  As with
   most other <quote>drop</quote> commands, <command>DROP
   TYPE</command> in SQL99 requires a <quote>drop behavior</quote>
   clause to select between dropping all dependent objects or refusing
   to drop if dependent objects exist:
<synopsis>
DROP TYPE <replaceable>name</replaceable> { CASCADE | RESTRICT }
</synopsis>
   <productname>PostgreSQL</productname> currently ignores
   dependencies altogether.
  </para>

  <para>
   Note that the <command>CREATE TYPE</command> command and the data
   type extension mechanisms in <productname>PostgreSQL</productname>
   differ from SQL99.
  </para>
 </refsect1>

 <refsect1 id="SQL-DROPTYPE-see-also">
  <title>See Also</title>

  <simplelist type="inline">
   <member><xref linkend="sql-createtype"></member>
  </simplelist>
 </refsect1>
</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->
