Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
5225c663
Commit
5225c663
authored
Sep 15, 2016
by
Robert Haas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clarify policy on marking inherited constraints as valid.
Amit Langote and Robert Haas
parent
5c6df67e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
doc/src/sgml/ref/alter_table.sgml
doc/src/sgml/ref/alter_table.sgml
+9
-5
src/backend/commands/tablecmds.c
src/backend/commands/tablecmds.c
+2
-1
No files found.
doc/src/sgml/ref/alter_table.sgml
View file @
5225c663
...
@@ -1028,11 +1028,15 @@ ALTER TABLE ALL IN TABLESPACE <replaceable class="PARAMETER">name</replaceable>
...
@@ -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>
...
...
src/backend/commands/tablecmds.c
View file @
5225c663
...
@@ -6908,7 +6908,8 @@ ATExecValidateConstraint(Relation rel, char *constrName, bool recurse,
...
@@ -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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment