Document lack of validation when attaching foreign partitions.
Ashutosh Bapat, revised a bit by me. Discussion: http://postgr.es/m/CAFjFpRdLaCa-1wJase0=YWG5o3cJnbuUt_vrqm2TDBKM_vQ_oA@mail.gmail.com
This commit is contained in:
parent
054637d2e0
commit
b54aad8e34
@ -743,18 +743,25 @@ ALTER TABLE [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable>
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
A full table scan is performed on the table being attached to check that
|
If the new partition is a regular table, a full table scan is performed
|
||||||
no existing row in the table violates the partition constraint. It is
|
to check that no existing row in the table violates the partition
|
||||||
possible to avoid this scan by adding a valid <literal>CHECK</literal>
|
constraint. It is possible to avoid this scan by adding a valid
|
||||||
constraint to the table that would allow only the rows satisfying the
|
<literal>CHECK</literal> constraint to the table that would allow only
|
||||||
desired partition constraint before running this command. It will be
|
the rows satisfying the desired partition constraint before running this
|
||||||
determined using such a constraint that the table need not be scanned
|
command. It will be determined using such a constraint that the table
|
||||||
to validate the partition constraint. This does not work, however, if
|
need not be scanned to validate the partition constraint. This does not
|
||||||
any of the partition keys is an expression and the partition does not
|
work, however, if any of the partition keys is an expression and the
|
||||||
accept <literal>NULL</literal> values. If attaching a list partition
|
partition does not accept <literal>NULL</literal> values. If attaching
|
||||||
that will not accept <literal>NULL</literal> values, also add
|
a list partition that will not accept <literal>NULL</literal> values,
|
||||||
<literal>NOT NULL</literal> constraint to the partition key column,
|
also add <literal>NOT NULL</literal> constraint to the partition key
|
||||||
unless it's an expression.
|
column, unless it's an expression.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
If the new partition is a foreign table, nothing is done to verify
|
||||||
|
that all the rows in the foreign table obey the partition constraint.
|
||||||
|
(See the discussion in <xref linkend="SQL-CREATEFOREIGNTABLE"> about
|
||||||
|
constraints on the foreign table.)
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user