*** a/src/backend/parser/analyze.c --- b/src/backend/parser/analyze.c *************** *** 2107,2118 **** transformUpdateTargetList(ParseState *pstate, List *origTlist) attrno = attnameAttNum(pstate->p_target_relation, origTarget->name, true); if (attrno == InvalidAttrNumber) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_COLUMN), errmsg("column \"%s\" of relation \"%s\" does not exist", origTarget->name, ! RelationGetRelationName(pstate->p_target_relation)), parser_errposition(pstate, origTarget->location))); updateTargetListEntry(pstate, tle, origTarget->name, attrno, --- 2107,2136 ---- attrno = attnameAttNum(pstate->p_target_relation, origTarget->name, true); if (attrno == InvalidAttrNumber) + { + bool need_hint = false; + + /* + * Table-qualifying the LHS expression in SET is a common mistake; + * provide a hint if that seems to be the problem. + */ + if (origTarget->indirection != NIL && + IsA(linitial(origTarget->indirection), String)) + { + if (strcmp(origTarget->name, RelationGetRelationName(pstate->p_target_relation)) == 0) + need_hint = true; + else if (target_rte->alias && strcmp(origTarget->name, target_rte->alias->aliasname) == 0) + need_hint = true; + } + ereport(ERROR, (errcode(ERRCODE_UNDEFINED_COLUMN), errmsg("column \"%s\" of relation \"%s\" does not exist", origTarget->name, ! RelationGetRelationName(pstate->p_target_relation)), ! need_hint ? errhint("Do not qualify an UPDATE target column with the name of the table.") : 0, parser_errposition(pstate, origTarget->location))); + } updateTargetListEntry(pstate, tle, origTarget->name, attrno,