diff --git a/src/backend/access/common/attmap.c b/src/backend/access/common/attmap.c
index b0fe27ef57..85f7c0cb8c 100644
--- a/src/backend/access/common/attmap.c
+++ b/src/backend/access/common/attmap.c
@@ -118,12 +118,13 @@ build_attrmap_by_position(TupleDesc indesc,
 				ereport(ERROR,
 						(errcode(ERRCODE_DATATYPE_MISMATCH),
 						 errmsg_internal("%s", _(msg)),
-						 errdetail("Returned type %s does not match expected type %s in column %d.",
+						 errdetail("Returned type %s does not match expected type %s in column %d-%s.",
 								   format_type_with_typemod(att->atttypid,
 															att->atttypmod),
 								   format_type_with_typemod(atttypid,
 															atttypmod),
-								   noutcols)));
+								   noutcols,
+								   att->attname)));
 			attrMap->attnums[i] = (AttrNumber) (j + 1);
 			j++;
 			break;
