*** a/src/backend/parser/analyze.c --- b/src/backend/parser/analyze.c *************** *** 730,742 **** transformInsertRow(ParseState *pstate, List *exprlist, list_length(icolumns)))))); if (stmtcols != NIL && list_length(exprlist) < list_length(icolumns)) ! ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("INSERT has more target columns than expressions"), parser_errposition(pstate, exprLocation(list_nth(icolumns, list_length(exprlist)))))); /* * Prepare columns for assignment to target table. */ --- 730,761 ---- list_length(icolumns)))))); if (stmtcols != NIL && list_length(exprlist) < list_length(icolumns)) ! { ! /* ! * If the expression only has a single column of type record, it's ! * possible that that wasn't intended. ! */ ! if (list_length(exprlist) == 1 && ! (IsA(linitial(exprlist), Var) && ! ((Var *) linitial(exprlist))->vartype == RECORDOID) || ! IsA(linitial(exprlist), RowExpr)) ! ereport(ERROR, ! (errcode(ERRCODE_SYNTAX_ERROR), ! errmsg("INSERT has more target columns than expressions"), ! errhint("Did you accidentally use extra parentheses?"), ! parser_errposition(pstate, ! exprLocation(list_nth(icolumns, ! list_length(exprlist)))))); ! else ! ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("INSERT has more target columns than expressions"), parser_errposition(pstate, exprLocation(list_nth(icolumns, list_length(exprlist)))))); + } + /* * Prepare columns for assignment to target table. */