> > errmsg("cannot validated NOT ENFORCED constraint"))); > should be > errmsg("cannot validate NOT ENFORCED constraint"))); > ? >
looking at it again. if (!con->conenforced) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("cannot validated NOT ENFORCED constraint"))); ERRCODE_WRONG_OBJECT_TYPE is not that ok? maybe ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE or ERRCODE_INVALID_TABLE_DEFINITION if (!con->conenforced) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("cannot validated NOT ENFORCED constraint"))); if (!con->convalidated) { .... if (con->contype == CONSTRAINT_FOREIGN) { /* * Queue validation for phase 3 only if constraint is enforced; * otherwise, adding it to the validation queue won't be very * effective, as the verification will be skipped. */ if (con->conenforced) ...... } in ATExecValidateConstraint "" if (con->conenforced)""" will always be true?