!6091 【回合6.0.0】修复insertrow中存在用户变量时异常报错的问题

Merge pull request !6091 from chenxiaobin/6.0.0
This commit is contained in:
opengauss_bot
2024-08-21 03:08:13 +00:00
committed by Gitee
4 changed files with 16 additions and 2 deletions

View File

@ -2098,8 +2098,7 @@ bool expression_tree_walker(Node* node, bool (*walker)(), void* context)
case T_PrefixKey:
return p2walker(((PrefixKey*)node)->arg, context);
case T_UserSetElem: {
p2walker(((UserSetElem*)node)->val, context);
return true;
return p2walker(((UserSetElem*)node)->val, context);
}
case T_PriorExpr:
return p2walker(((PriorExpr*)node)->node, context);

View File

@ -1191,6 +1191,9 @@ static bool contain_specified_functions_walker(Node* node, check_function_contex
} else if (IsA(node, Query) && context->deep) {
/* Recurse into subselects */
return query_tree_walker((Query*)node, (bool (*)())contain_specified_functions_walker<isSimpleVar>, context, 0);
} else if (IsA(node, UserSetElem)) {
/* UserSetElem is volatile */
return context->checktype == CONTAIN_VOLATILE_FUNTION;
}
return expression_tree_walker(node, (bool (*)())contain_specified_functions_walker<isSimpleVar>, context);
}

View File

@ -774,6 +774,13 @@ END WHILE label_1;
end;
/
SELECT TRIM(TRAILING ', ' FROM @sequence);
set enable_set_variable_b_format = 1;
CREATE TABLE userset_t1 (a VARCHAR(500) CHARACTER SET UTF8);
SET @num=1000;
INSERT INTO userset_t1 VALUES (CONCAT((@num:=@num+1), 'a'));
set enable_set_variable_b_format = default;
\c regression
drop database if exists test_set;

View File

@ -1520,6 +1520,11 @@ SELECT TRIM(TRAILING ', ' FROM @sequence);
1, 2, 3, 4, 5, 6, 7, 8, 9, 10
(1 row)
set enable_set_variable_b_format = 1;
CREATE TABLE userset_t1 (a VARCHAR(500) CHARACTER SET UTF8);
SET @num=1000;
INSERT INTO userset_t1 VALUES (CONCAT((@num:=@num+1), 'a'));
set enable_set_variable_b_format = default;
\c regression
drop database if exists test_set;
\! @abs_bindir@/gs_guc reload -Z datanode -D @abs_srcdir@/tmp_check/datanode1 -c "enable_set_variable_b_format=off" >/dev/null 2>&1