@ -142,9 +142,9 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
<para>
<para>
<command>ALTER TABLE</command> changes the definition of an existing table.
<command>ALTER TABLE</command> changes the definition of an existing table.
There are several subforms described below. Note that the lock level required
There are several subforms described below. Note that the lock level required
may differ for each subform. An <literal>ACCESS EXCLUSIVE</literal> lock is held
may differ for each subform. An <literal>ACCESS EXCLUSIVE</literal> lock is
unless explicitly noted. When multiple subcommands are listed, the lock
acquired unless explicitly noted. When multiple subcommands are given, the
held will be the strictest one required from any subcommand.
lock acquired will be the strictest one required by any subcommand.
<variablelist>
<variablelist>
<varlistentry>
<varlistentry>
@ -387,8 +387,8 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
<term><literal>ADD <replaceable class="parameter">table_constraint</replaceable> [ NOT VALID ]</literal></term>
<term><literal>ADD <replaceable class="parameter">table_constraint</replaceable> [ NOT VALID ]</literal></term>
<listitem>
<listitem>
<para>
<para>
This form adds a new constraint to a table using the same syntax as
This form adds a new constraint to a table using the same constraint
<xref linkend="sql-createtable"/>, plus the option <literal>NOT
syntax as <xref linkend="sql-createtable"/>, plus the option <literal>NOT
VALID</literal>, which is currently only allowed for foreign key
VALID</literal>, which is currently only allowed for foreign key
and CHECK constraints.
and CHECK constraints.
</para>
</para>
@ -411,9 +411,14 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
</para>
</para>
<para>
<para>
Addition of a foreign key constraint requires a
Although most forms of <literal>ADD
<literal>SHARE ROW EXCLUSIVE</literal> lock on the referenced table,
<replaceable class="parameter">table_constraint</replaceable></literal>
in addition to the lock on the table receiving the constraint.
require an <literal>ACCESS EXCLUSIVE</literal> lock, <literal>ADD
FOREIGN KEY</literal> requires only a <literal>SHARE ROW
EXCLUSIVE</literal> lock. Note that <literal>ADD FOREIGN KEY</literal>
also acquires a <literal>SHARE ROW EXCLUSIVE</literal> lock on the
referenced table, in addition to the lock on the table on which the
constraint is declared.
</para>
</para>
<para>
<para>