B库下insert、upsert的用户变量与列名相同时,取用户变量优先级最高,与MySQL保持一致

This commit is contained in:
laishenghao
2022-12-01 16:19:18 +08:00
parent f4f3dd08ac
commit c0ab0b37c1
4 changed files with 51 additions and 5 deletions

View File

@ -966,10 +966,15 @@ Node* transformColumnRef(ParseState* pstate, ColumnRef* cref)
if (node == NULL) {
node = hookresult;
} else if (hookresult != NULL) {
ereport(ERROR,
(errcode(ERRCODE_AMBIGUOUS_COLUMN),
errmsg("column reference \"%s\" is ambiguous", NameListToString(cref->fields)),
parser_errposition(pstate, cref->location)));
if (IS_SUPPORT_RIGHT_REF(pstate->rightRefState)) {
node = hookresult;
} else {
ereport(ERROR,
(errcode(ERRCODE_AMBIGUOUS_COLUMN),
errmsg("column reference \"%s\" is ambiguous", NameListToString(cref->fields)),
parser_errposition(pstate, cref->location)));
}
}
}