diff options
author | Amit Kapila <akapila@postgresql.org> | 2020-01-28 07:48:10 +0530 |
---|---|---|
committer | Amit Kapila <akapila@postgresql.org> | 2020-01-28 07:48:10 +0530 |
commit | 05f18c6b6b6e4b44302ee20a042cedc664532aa2 (patch) | |
tree | 312f27295ec5e9623b517bb61550b76a4df093e0 /src/backend/executor/execMain.c | |
parent | ff8ca5fadd819155c82bd16fcc6b7231af649cf8 (diff) | |
download | postgresql-05f18c6b6b6e4b44302ee20a042cedc664532aa2.tar.gz postgresql-05f18c6b6b6e4b44302ee20a042cedc664532aa2.zip |
Added relation name in error messages for constraint checks.
This gives more information to the user about the error and it makes such
messages consistent with the other similar messages in the code.
Reported-by: Simon Riggs
Author: Mahendra Singh and Simon Riggs
Reviewed-by: Beena Emerson and Amit Kapila
Discussion: https://postgr.es/m/CANP8+j+7YUvQvGxTrCiw77R23enMJ7DFmyA3buR+fa2pKs4XhA@mail.gmail.com
Diffstat (limited to 'src/backend/executor/execMain.c')
-rw-r--r-- | src/backend/executor/execMain.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index b03e02ae6c3..3a9ce992a3b 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -1957,8 +1957,9 @@ ExecConstraints(ResultRelInfo *resultRelInfo, ereport(ERROR, (errcode(ERRCODE_NOT_NULL_VIOLATION), - errmsg("null value in column \"%s\" violates not-null constraint", - NameStr(att->attname)), + errmsg("null value in column \"%s\" of relation \"%s\" violates not-null constraint", + NameStr(att->attname), + RelationGetRelationName(orig_rel)), val_desc ? errdetail("Failing row contains %s.", val_desc) : 0, errtablecol(orig_rel, attrChk))); } |