Clarify policy on marking inherited constraints as valid.
Amit Langote and Robert Haas
This commit is contained in:
parent
5c6df67e0c
commit
5225c66336
|
@ -1028,11 +1028,15 @@ ALTER TABLE ALL IN TABLESPACE <replaceable class="PARAMETER">name</replaceable>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
If a table has any descendant tables, it is not permitted to add,
|
If a table has any descendant tables, it is not permitted to add,
|
||||||
rename, or change the type of a column, or rename an inherited constraint
|
rename, or change the type of a column in the parent table without doing
|
||||||
in the parent table without doing
|
same to the descendants. This ensures that the descendants always have
|
||||||
the same to the descendants. That is, <command>ALTER TABLE ONLY</command>
|
columns matching the parent. Similarly, a constraint cannot be renamed
|
||||||
will be rejected. This ensures that the descendants always have
|
in the parent without also renaming it in all descendents, so that
|
||||||
columns matching the parent.
|
constraints also match between the parent and its descendents.
|
||||||
|
Also, because selecting from the parent also selects from its descendents,
|
||||||
|
a constraint on the parent cannot be marked valid unless it is also marked
|
||||||
|
valid for those descendents. In all of these cases, <command>ALTER TABLE
|
||||||
|
ONLY</command> will be rejected.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
|
|
|
@ -6908,7 +6908,8 @@ ATExecValidateConstraint(Relation rel, char *constrName, bool recurse,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we are told not to recurse, there had better not be any
|
* If we are told not to recurse, there had better not be any
|
||||||
* child tables; else the addition would put them out of step.
|
* child tables, because we can't mark the constraint on the
|
||||||
|
* parent valid unless it is valid for all child tables.
|
||||||
*/
|
*/
|
||||||
if (!recurse)
|
if (!recurse)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
|
|
Loading…
Reference in New Issue