Home Explore Blog CI



postgresql

2nd chunk of `doc/src/sgml/ref/alter_type.sgml`
ed053f03a028b7fd18080e04a3c4045a09d70ef1811a9b520000000100000fa3
 <term><literal>RENAME</literal></term>
    <listitem>
     <para>
      This form changes the name of the type.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>SET SCHEMA</literal></term>
    <listitem>
     <para>
      This form moves the type into another schema.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>RENAME ATTRIBUTE</literal></term>
    <listitem>
     <para>
      This form is only usable with composite types.
      It changes the name of an individual attribute of the type.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>ADD ATTRIBUTE</literal></term>
    <listitem>
     <para>
      This form adds a new attribute to a composite type, using the same syntax as
      <link linkend="sql-createtype"><command>CREATE TYPE</command></link>.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>DROP ATTRIBUTE [ IF EXISTS ]</literal></term>
    <listitem>
     <para>
      This form drops an attribute from a composite type.
      If <literal>IF EXISTS</literal> is specified and the attribute
      does not exist, no error is thrown. In this case a notice
      is issued instead.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>ALTER ATTRIBUTE ... SET DATA TYPE</literal></term>
    <listitem>
     <para>
      This form changes the type of an attribute of a composite type.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>ADD VALUE [ IF NOT EXISTS ] [ BEFORE | AFTER ]</literal></term>
    <listitem>
     <para>
      This form adds a new value to an enum type.  The new value's place in
      the enum's ordering can be specified as being <literal>BEFORE</literal>
      or <literal>AFTER</literal> one of the existing values.  Otherwise,
      the new item is added at the end of the list of values.
     </para>
     <para>
      If <literal>IF NOT EXISTS</literal> is specified, it is not an error if
      the type already contains the new value: a notice is issued but no other
      action is taken. Otherwise, an error will occur if the new value is
      already present.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>RENAME VALUE</literal></term>
    <listitem>
     <para>
      This form renames a value of an enum type.
      The value's place in the enum's ordering is not affected.
      An error will occur if the specified value is not present or the new
      name is already present.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term>
     <literal>SET ( <replaceable class="parameter">property</replaceable> = <replaceable class="parameter">value</replaceable> [, ... ] )</literal>
    </term>
    <listitem>
     <para>
      This form is only applicable to base types.  It allows adjustment of a
      subset of the base-type properties that can be set in <command>CREATE
      TYPE</command>.  Specifically, these properties can be changed:
      <itemizedlist>
       <listitem>
        <para>
         <literal>RECEIVE</literal> can be set to the name of a binary input
         function, or <literal>NONE</literal> to remove the type's binary
         input function.  Using this option requires superuser privilege.
        </para>
       </listitem>
       <listitem>
        <para>
         <literal>SEND</literal> can be set to the name of a binary output
         function, or <literal>NONE</literal> to remove the type's binary
         output function.  Using this option requires superuser privilege.
        </para>
       </listitem>
       <listitem>
        <para>
         <literal>TYPMOD_IN</literal> can be set to the name of a type
         modifier input function, or <literal>NONE</literal> to remove the
         type's type modifier input function.  Using this option requires
         superuser privilege.
        </para>
       </listitem>

Title: ALTER TYPE Subforms: Modifying Composite and Enum Types
Summary
The `ALTER TYPE` command includes subforms for dropping an attribute from a composite type, changing the data type of an attribute, adding a new value to an enum type (specifying its position), renaming an enum value, and setting properties for base types like RECEIVE, SEND, and TYPMOD_IN, which require superuser privileges.