Home Explore Blog CI



postgresql

3rd chunk of `doc/src/sgml/ref/alter_foreign_table.sgml`
4399dafac03e223fb1bcb16c35418338fba44688e45622bb0000000100000fa0
 DEFAULT</literal></term>
    <listitem>
     <para>
      These forms set or remove the default value for a column.
      Default values only apply in subsequent <command>INSERT</command>
      or <command>UPDATE</command> commands; they do not cause rows already in the
      table to change.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>SET</literal>/<literal>DROP NOT NULL</literal></term>
    <listitem>
     <para>
      Mark a column as allowing, or not allowing, null values.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>SET STATISTICS</literal></term>
    <listitem>
     <para>
      This form
      sets the per-column statistics-gathering target for subsequent
      <link linkend="sql-analyze"><command>ANALYZE</command></link> operations.
      See the similar form of <link linkend="sql-altertable"><command>ALTER TABLE</command></link>
      for more details.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>SET ( <replaceable class="parameter">attribute_option</replaceable> = <replaceable class="parameter">value</replaceable> [, ... ] )</literal></term>
    <term><literal>RESET ( <replaceable class="parameter">attribute_option</replaceable> [, ... ] )</literal></term>
    <listitem>
     <para>
      This form sets or resets per-attribute options.
      See the similar form of <link linkend="sql-altertable"><command>ALTER TABLE</command></link>
      for more details.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term>
     <literal>SET STORAGE</literal>
    </term>
    <listitem>
     <para>
      This form sets the storage mode for a column.
      See the similar form of <link linkend="sql-altertable"><command>ALTER TABLE</command></link>
      for more details.
      Note that the storage mode has no effect unless the table's
      foreign-data wrapper chooses to pay attention to it.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>ADD <replaceable class="parameter">table_constraint</replaceable> [ NOT VALID ]</literal></term>
    <listitem>
     <para>
      This form adds a new constraint to a foreign table, using the same
      syntax as <link linkend="sql-createforeigntable"><command>CREATE FOREIGN TABLE</command></link>.
      Currently only <literal>CHECK</literal> and <literal>NOT NULL</literal>
      constraints are supported.
     </para>

     <para>
      Unlike the case when adding a constraint to a regular table, nothing is
      done to verify the constraint is correct; rather, this action simply
      declares that some new condition should be assumed to hold for all rows
      in the foreign table.  (See the discussion
      in <link linkend="sql-createforeigntable"><command>CREATE FOREIGN TABLE</command></link>.)
      If the constraint is marked <literal>NOT VALID</literal> (allowed only for
      the <literal>CHECK</literal> case), then it isn't
      assumed to hold, but is only recorded for possible future use.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>VALIDATE CONSTRAINT</literal></term>
    <listitem>
     <para>
      This form marks as valid a constraint that was previously marked
      as <literal>NOT VALID</literal>.  No action is taken to verify the
      constraint, but future queries will assume that it holds.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>DROP CONSTRAINT [ IF EXISTS ]</literal></term>
    <listitem>
     <para>
      This form drops the specified constraint on a foreign table.
      If <literal>IF EXISTS</literal> is specified and the constraint
      does not exist, no error is thrown.
      In this case a notice is issued instead.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>DISABLE</literal>/<literal>ENABLE [ REPLICA | ALWAYS ] TRIGGER</literal></term>
    <listitem>
  

Title: ALTER FOREIGN TABLE - Column and Constraint Modifications
Summary
This section details how ALTER FOREIGN TABLE handles column modifications like setting defaults, NULL constraints, statistics, storage modes, and adding/validating/dropping constraints (CHECK, NOT NULL). It also explains disabling/enabling triggers with options for REPLICA or ALWAYS.