*** a/src/backend/parser/analyze.c --- b/src/backend/parser/analyze.c *************** *** 1989,2000 **** transformUpdateStmt(ParseState *pstate, UpdateStmt *stmt) 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, --- 1989,2019 ---- attrno = attnameAttNum(pstate->p_target_relation, origTarget->name, true); if (attrno == InvalidAttrNumber) + { + const char *relname; + const char *message_hint = NULL; + + /* + * Table-qualifying the LHS expression in SET is a common mistake; + * provide a hint if that seems to be the problem. + */ + relname = RelationGetRelationName(pstate->p_target_relation); + if (strcmp(origTarget->name, relname) == 0 && + origTarget->indirection != NIL) + { + Node *ind = linitial(origTarget->indirection); + if (IsA(ind, String)) + message_hint = "Target column references in UPDATE must not be qualified"; + } + ereport(ERROR, (errcode(ERRCODE_UNDEFINED_COLUMN), errmsg("column \"%s\" of relation \"%s\" does not exist", origTarget->name, ! relname), ! message_hint ? errhint("%s", message_hint) : 0, parser_errposition(pstate, origTarget->location))); + } updateTargetListEntry(pstate, tle, origTarget->name, attrno,