commit 27ede32cd35afc2872152c9edcd91f05feda1fe0 Author: Mahendra Singh Thalor Date: Wed Jan 22 09:47:44 2020 +0530 fixed error message inconsistancy diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 30b72b6..b0bed6a 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -5272,8 +5272,9 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap, LOCKMODE lockmode) ereport(ERROR, (errcode(ERRCODE_NOT_NULL_VIOLATION), - errmsg("column \"%s\" contains null values", - NameStr(attr->attname)), + errmsg("column \"%s\" of relation \"%s\" contains null values", + NameStr(attr->attname), + RelationGetRelationName(oldrel)), errtablecol(oldrel, attn + 1))); } } @@ -5288,8 +5289,9 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap, LOCKMODE lockmode) if (!ExecCheck(con->qualstate, econtext)) ereport(ERROR, (errcode(ERRCODE_CHECK_VIOLATION), - errmsg("check constraint \"%s\" is violated by some row", - con->name), + errmsg("check constraint \"%s\" of relation \"%s\" is violated by some row", + con->name, + RelationGetRelationName(oldrel)), errtableconstraint(oldrel, con->name))); break; case CONSTR_FOREIGN: @@ -5306,11 +5308,13 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap, LOCKMODE lockmode) if (tab->validate_default) ereport(ERROR, (errcode(ERRCODE_CHECK_VIOLATION), - errmsg("updated partition constraint for default partition would be violated by some row"))); + errmsg("updated partition constraint for default partition \"%s\" would be violated by some row", + RelationGetRelationName(oldrel)))); else ereport(ERROR, (errcode(ERRCODE_CHECK_VIOLATION), - errmsg("partition constraint is violated by some row"))); + errmsg("partition constraint \"%s\" is violated by some row", + RelationGetRelationName(oldrel)))); } /* Write the tuple out to the new relation */ @@ -10140,8 +10144,9 @@ validateCheckConstraint(Relation rel, HeapTuple constrtup) if (!ExecCheck(exprstate, econtext)) ereport(ERROR, (errcode(ERRCODE_CHECK_VIOLATION), - errmsg("check constraint \"%s\" is violated by some row", - NameStr(constrForm->conname)), + errmsg("check constraint \"%s\" of relation \"%s\" is violated by some row", + NameStr(constrForm->conname), + RelationGetRelationName(rel)), errtableconstraint(rel, NameStr(constrForm->conname)))); ResetExprContext(econtext); diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index b03e02a..3a9ce99 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))); }