!3228 对函数表达式计算阶段判断是否包含游标(refcursor)的逻辑进行剪枝

Merge pull request !3228 from cc_db_dev/iud_2_pr
This commit is contained in:
opengauss-bot
2023-05-24 01:56:10 +00:00
committed by Gitee
7 changed files with 40 additions and 4 deletions

View File

@ -2905,6 +2905,13 @@ extern bool func_has_refcursor_args(Oid Funcid, FunctionCallInfoData* fcinfo)
bool return_refcursor = false;
int out_count = 0; /* out arg count */
fcinfo->refcursor_data.return_number = 0;
fcinfo->refcursor_data.returnCursor = NULL;
if (IsSystemObjOid(Funcid) && Funcid != CURSORTOXMLOID && Funcid != CURSORTOXMLSCHEMAOID) {
return false;
}
proctup = SearchSysCache(PROCOID, ObjectIdGetDatum(Funcid), 0, 0, 0);
/*
@ -2918,8 +2925,6 @@ extern bool func_has_refcursor_args(Oid Funcid, FunctionCallInfoData* fcinfo)
allarg = get_func_arg_info(proctup, &p_argtypes, &p_argnames, &p_argmodes);
procStruct = (Form_pg_proc)GETSTRUCT(proctup);
fcinfo->refcursor_data.return_number = 0;
fcinfo->refcursor_data.returnCursor = NULL;
for (int i = 0; i < allarg; i++) {
if (p_argmodes != NULL && (p_argmodes[i] == 'o' || p_argmodes[i] == 'b')) {
out_count++;