!680 回合master分支的bugfix到1.1.0

Merge pull request !680 from TotaJ/tmp
This commit is contained in:
opengauss-bot 2021-02-08 10:43:14 +08:00 committed by Gitee
commit 49b024f022
4 changed files with 59 additions and 4 deletions

View File

@ -10319,9 +10319,9 @@ createfunc_opt_list:
| createfunc_opt_list createfunc_opt_item { $$ = lappend($1, $2); }
;
opt_createproc_opt_list:
createproc_opt_item
opt_createproc_opt_list createproc_opt_item
{
$$ = list_make1($1);
$$ = lappend($1, $2);
}
| /* EMPTY */
{

View File

@ -8989,7 +8989,16 @@ int PostgresMain(int argc, char* argv[], const char* dbname, const char* usernam
#endif
exec_init_poolhandles();
/*
* Enable pbe optimization in batch mode, cause it may generate too many cplan
* when enable_pbe_optimization is false, which may consume lots of memory and
* lead to 'memory alloc failed'. To avoid this problem, enable pbe optimization
* to use gplan in this batch.
*/
bool original = u_sess->attr.attr_sql.enable_pbe_optimization;
u_sess->attr.attr_sql.enable_pbe_optimization = true;
exec_batch_bind_execute(&input_message);
u_sess->attr.attr_sql.enable_pbe_optimization = original;
if (is_unique_sql_enabled() && is_local_unique_sql()) {
UpdateUniqueSQLStat(NULL, NULL, GetCurrentStatementLocalStartTimestamp());
}
@ -10290,7 +10299,6 @@ static void exec_batch_bind_execute(StringInfo input_message)
}
Assert(NULL != psrc);
SetUniqueSQLIdFromCachedPlanSource(psrc);
/* Check command type: only support IUD */
initStringInfo(&process_result);
@ -10339,6 +10347,7 @@ static void exec_batch_bind_execute(StringInfo input_message)
* we are already in one.
*/
start_xact_command();
SetUniqueSQLIdFromCachedPlanSource(psrc);
if (ENABLE_WORKLOAD_CONTROL && SqlIsValid(t_thrd.postgres_cxt.debug_query_string) &&
(IS_PGXC_COORDINATOR || IS_SINGLE_NODE) &&

View File

@ -742,3 +742,32 @@ CALL PRO_NO_EXP_001_1();
(1 row)
create table test_emp_001(name varchar(10));
create or replace procedure test_proc_using_001(a int) SHIPPABLE LEAKPROOF CALLED ON NULL INPUT external security invoker cost 0.000056
as
v_sql varchar2(2000);
begin
v_sql := 'insert into test_emp_001 values (:v1)';
execute immediate v_sql using 'kimy';
end;
/
call test_proc_using_001(1);
test_proc_using_001
---------------------
(1 row)
select * from test_emp_001;
name
------
kimy
(1 row)
select prosecdef,procost,proleakproof,proisstrict,proshippable,prokind from pg_proc where proname='test_proc_using_001';
prosecdef | procost | proleakproof | proisstrict | proshippable | prokind
-----------+---------+--------------+-------------+--------------+---------
f | 5.6e-05 | t | f | t | p
(1 row)
drop table test_emp_001;
drop procedure test_proc_using_001;

View File

@ -584,4 +584,21 @@ END;
/
CALL PRO_NO_EXP_001_1();
CALL PRO_NO_EXP_001_1();
CALL PRO_NO_EXP_001_1();
create table test_emp_001(name varchar(10));
create or replace procedure test_proc_using_001(a int) SHIPPABLE LEAKPROOF CALLED ON NULL INPUT external security invoker cost 0.000056
as
v_sql varchar2(2000);
begin
v_sql := 'insert into test_emp_001 values (:v1)';
execute immediate v_sql using 'kimy';
end;
/
call test_proc_using_001(1);
select * from test_emp_001;
select prosecdef,procost,proleakproof,proisstrict,proshippable,prokind from pg_proc where proname='test_proc_using_001';
drop table test_emp_001;
drop procedure test_proc_using_001;