Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5225c66

Browse files
committed
Clarify policy on marking inherited constraints as valid.
Amit Langote and Robert Haas
1 parent5c6df67 commit5225c66

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

‎doc/src/sgml/ref/alter_table.sgml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,11 +1028,15 @@ ALTER TABLE ALL IN TABLESPACE <replaceable class="PARAMETER">name</replaceable>
10281028

10291029
<para>
10301030
If a table has any descendant tables, it is not permitted to add,
1031-
rename, or change the type of a column, or rename an inherited constraint
1032-
in the parent table without doing
1033-
the same to the descendants. That is, <command>ALTER TABLE ONLY</command>
1034-
will be rejected. This ensures that the descendants always have
1035-
columns matching the parent.
1031+
rename, or change the type of a column in the parent table without doing
1032+
same to the descendants. This ensures that the descendants always have
1033+
columns matching the parent. Similarly, a constraint cannot be renamed
1034+
in the parent without also renaming it in all descendents, so that
1035+
constraints also match between the parent and its descendents.
1036+
Also, because selecting from the parent also selects from its descendents,
1037+
a constraint on the parent cannot be marked valid unless it is also marked
1038+
valid for those descendents. In all of these cases, <command>ALTER TABLE
1039+
ONLY</command> will be rejected.
10361040
</para>
10371041

10381042
<para>

‎src/backend/commands/tablecmds.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6908,7 +6908,8 @@ ATExecValidateConstraint(Relation rel, char *constrName, bool recurse,
69086908

69096909
/*
69106910
* If we are told not to recurse, there had better not be any
6911-
* child tables; else the addition would put them out of step.
6911+
* child tables, because we can't mark the constraint on the
6912+
* parent valid unless it is valid for all child tables.
69126913
*/
69136914
if (!recurse)
69146915
ereport(ERROR,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp