Home Explore Blog CI



postgresql

7th chunk of `doc/src/sgml/ref/alter_foreign_table.sgml`
29514a1fc74e3518fc9c1adf8599b57481a45ead1899515c0000000100000ed6
  </varlistentry>

     <varlistentry>
      <term><replaceable class="parameter">trigger_name</replaceable></term>
      <listitem>
       <para>
        Name of a single trigger to disable or enable.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><literal>ALL</literal></term>
      <listitem>
       <para>
        Disable or enable all triggers belonging to the foreign table.  (This
        requires superuser privilege if any of the triggers are internally
        generated triggers.  The core system does not add such triggers to
        foreign tables, but add-on code could do so.)
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><literal>USER</literal></term>
      <listitem>
       <para>
        Disable or enable all triggers belonging to the foreign table except
        for internally generated triggers.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><replaceable class="parameter">parent_table</replaceable></term>
      <listitem>
       <para>
        A parent table to associate or de-associate with this foreign table.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><replaceable class="parameter">new_owner</replaceable></term>
      <listitem>
       <para>
        The user name of the new owner of the table.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><replaceable class="parameter">new_schema</replaceable></term>
      <listitem>
       <para>
        The name of the schema to which the table will be moved.
       </para>
      </listitem>
     </varlistentry>
    </variablelist>
 </refsect1>

 <refsect1>
  <title>Notes</title>

   <para>
    The key word <literal>COLUMN</literal> is noise and can be omitted.
   </para>

   <para>
    Consistency with the foreign server is not checked when a column is added
    or removed with <literal>ADD COLUMN</literal> or
    <literal>DROP COLUMN</literal>, a <literal>NOT NULL</literal>
    or <literal>CHECK</literal> constraint is added, or a column type is changed
    with <literal>SET DATA TYPE</literal>.  It is the user's responsibility to ensure
    that the table definition matches the remote side.
   </para>

   <para>
    Refer to <link linkend="sql-createforeigntable"><command>CREATE FOREIGN TABLE</command></link> for a further description of valid
    parameters.
   </para>
 </refsect1>

 <refsect1>
  <title>Examples</title>

  <para>
   To mark a column as not-null:
<programlisting>
ALTER FOREIGN TABLE distributors ALTER COLUMN street SET NOT NULL;
</programlisting>
  </para>

  <para>
   To change options of a foreign table:
<programlisting>
ALTER FOREIGN TABLE myschema.distributors OPTIONS (ADD opt1 'value', SET opt2 'value2', DROP opt3);
</programlisting></para>

 </refsect1>

 <refsect1>
  <title>Compatibility</title>

  <para>
   The forms <literal>ADD</literal>, <literal>DROP</literal>,
   and <literal>SET DATA TYPE</literal>
   conform with the SQL standard.  The other forms are
   <productname>PostgreSQL</productname> extensions of the SQL standard.
   Also, the ability to specify more than one manipulation in a single
   <command>ALTER FOREIGN TABLE</command> command is an extension.
  </para>

  <para>
   <command>ALTER FOREIGN TABLE DROP COLUMN</command> can be used to drop the only
   column of a foreign table, leaving a zero-column table.  This is an
   extension of SQL, which disallows zero-column foreign tables.
  </para>
 </refsect1>

 <refsect1>
  <title>See Also</title>

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

Title: ALTER FOREIGN TABLE: Parameters (End), Notes, Examples, and Compatibility
Summary
This section continues the list of parameters for ALTER FOREIGN TABLE, including trigger management (trigger name, ALL, USER), parent table association, owner and schema changes. It also includes notes on column consistency and references CREATE FOREIGN TABLE, provides examples of marking a column as not-null and changing table options, and details compatibility with the SQL standard and PostgreSQL extensions.