<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_type.sgml,v 1.2 2005/08/01 16:11:14 tgl Exp $
PostgreSQL documentation
-->

<refentry id="SQL-ALTERTYPE">
 <refmeta>
  <refentrytitle id="sql-altertype-title">ALTER TYPE</refentrytitle>
  <refmiscinfo>SQL - Language Statements</refmiscinfo>
 </refmeta>

 <refnamediv>
  <refname>
   ALTER TYPE
  </refname>
  <refpurpose>
   change the definition of a type
  </refpurpose>
 </refnamediv>

 <indexterm zone="sql-altertype">
  <primary>ALTER TYPE</primary>
 </indexterm>

 <refsynopsisdiv>
  <synopsis>
ALTER TYPE <replaceable class="PARAMETER">name</replaceable> OWNER TO <replaceable class="PARAMETER">new_owner</replaceable> 
ALTER TYPE <replaceable class="PARAMETER">name</replaceable> SET SCHEMA <replaceable class="PARAMETER">new_schema</replaceable>
  </synopsis>
 </refsynopsisdiv>

 <refsect1>
  <title>Description</title>

  <para>
   <command>ALTER TYPE</command> changes the definition of an existing type.
   The only currently available capabilities are changing the owner and schema
   of a type.
  </para>
 </refsect1>

 <refsect1>
  <title>Parameters</title>

   <para>
    <variablelist>
     <varlistentry>
      <term><replaceable class="PARAMETER">name</replaceable></term>
      <listitem>
       <para>
        The name (possibly schema-qualified) of an existing type to
        alter.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><replaceable class="PARAMETER">new_owner</replaceable></term>
      <listitem>
       <para>
        The user name of the new owner of the type.
        You must be a superuser to change a type's owner.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><replaceable class="PARAMETER">new_schema</replaceable></term>
      <listitem>
       <para>
        The new schema for the type.  To move a
        type to a new schema, you must be the owner of the
        type and have <literal>CREATE</> privilege on the new schema.
       </para>
      </listitem>
     </varlistentry>

    </variablelist>
   </para>
  </refsect1>

 <refsect1>
  <title>Examples</title>

  <para> 
   To change the owner of the user-defined type <literal>email</literal>
   to <literal>joe</literal>:
   <programlisting>
ALTER TYPE email OWNER TO joe;
   </programlisting>
  </para>

  <para>
   To change the schema of the user-defined type <literal>email</literal>
   to <literal>customers</literal>:
   <programlisting>
ALTER TYPE email SET SCHEMA customers;
   </programlisting>
  </para>
 </refsect1>

 <refsect1>
  <title>Compatibility</title>
    
  <para>
   There is no <command>ALTER TYPE</command> statement in the SQL
   standard.
  </para>
 </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:
-->
