1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-16 06:01:02 +03:00

When a row fails a not-null constraint, show row's contents in errdetail.

Simple extension of previous patch for CHECK constraints.
This commit is contained in:
Tom Lane
2011-11-29 18:29:18 -05:00
parent 8b08deb0d1
commit f225e4bc54
8 changed files with 23 additions and 1 deletions

View File

@ -1576,7 +1576,9 @@ ExecConstraints(ResultRelInfo *resultRelInfo,
ereport(ERROR,
(errcode(ERRCODE_NOT_NULL_VIOLATION),
errmsg("null value in column \"%s\" violates not-null constraint",
NameStr(rel->rd_att->attrs[attrChk - 1]->attname))));
NameStr(rel->rd_att->attrs[attrChk - 1]->attname)),
errdetail("Failing row contains %s.",
ExecBuildSlotValueDescription(slot, 64))));
}
}