diff options
author | Robert Haas <rhaas@postgresql.org> | 2017-04-28 14:48:38 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2017-04-28 14:53:56 -0400 |
commit | 954744f7ac759e2dfe1f52e4493f728b98c615f2 (patch) | |
tree | 7dfce66df2aac24b465599647263b6e41c8b0bc7 /src/backend/commands/tablecmds.c | |
parent | 8565808733ec127cf5972b4facc79889aee57850 (diff) |
Fix VALIDATE CONSTRAINT to consider NO INHERIT attribute.
Currently, trying to validate a NO INHERIT constraint on the parent will
search for the constraint in child tables (where it is not supposed to
exist), wrongly causing a "constraint does not exist" error.
Amit Langote, per a report from Hans Buschmann.
Discussion: http://postgr.es/m/20170421184012.24362.19@wrigleys.postgresql.org
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r-- | src/backend/commands/tablecmds.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 972e2c94b7f..471a44bf0d9 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -6262,9 +6262,10 @@ ATExecValidateConstraint(Relation rel, char *constrName, bool recurse, /* * If we're recursing, the parent has already done this, so skip - * it. + * it. Also, if the constraint is a NO INHERIT constraint, we + * shouldn't try to look for it in the children. */ - if (!recursing) + if (!recursing && !con->connoinherit) children = find_all_inheritors(RelationGetRelid(rel), lockmode, NULL); |