mirror of
https://github.com/postgres/postgres.git
synced 2025-06-17 17:02:08 +03:00
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
This commit is contained in:
@ -7704,9 +7704,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);
|
||||
|
||||
|
Reference in New Issue
Block a user