解决匿名块执行数据库宕机问题

This commit is contained in:
Julong-Li
2023-07-27 16:14:24 +08:00
parent 8c783b9104
commit 7832090f9b
5 changed files with 52 additions and 4 deletions

View File

@ -10064,6 +10064,7 @@ make_execsql_stmt(int firsttoken, int location)
PLpgSQL_nsitem* ns = plpgsql_ns_lookup(plpgsql_ns_top(), false, yylval.word.ident, NULL, NULL, NULL);
if (ns == NULL) {
yyerror("insert an nonexistent variable.");
continue;
}
PLpgSQL_datum* datum = u_sess->plsql_cxt.curr_compile_context->plpgsql_Datums[ns->itemno];

View File

@ -0,0 +1,35 @@
set plsql_show_all_error to on;
begin
forall i in 1 .. v1.count save exceptions insert into tb values v1(i);
end;
/
NOTICE: insert an nonexistent variable. at or near "v1"
LINE 2: ... 1 .. v1.count save exceptions insert into tb values v1(i);
^
QUERY: DECLARE
BEGIN forall i in 1 .. v1.count save exceptions insert into tb values v1(i);
end
ERROR: unsupported insert into table from non record type. at or near "i"
LINE 2: ... 1 .. v1.count save exceptions insert into tb values v1(i);
^
QUERY: DECLARE
BEGIN forall i in 1 .. v1.count save exceptions insert into tb values v1(i);
end
create procedure test_plsql_core()
is
begin
forall i in 1 .. v1.count save exceptions insert into tb values v1(i);
end;
/
NOTICE: insert an nonexistent variable. at or near "v1"
LINE 2: ...n 1 .. v1.count save exceptions insert into tb values v1(i);
^
QUERY: DECLARE begin
forall i in 1 .. v1.count save exceptions insert into tb values v1(i);
end
ERROR: unsupported insert into table from non record type. at or near "i"
LINE 2: ...n 1 .. v1.count save exceptions insert into tb values v1(i);
^
QUERY: DECLARE begin
forall i in 1 .. v1.count save exceptions insert into tb values v1(i);
end

View File

@ -1056,8 +1056,8 @@ test: describe_index_with_tablespace
test: sytcomp_del_upt4orderby
test: aioptimizer
test: aioptimizer_small
test: pgfincore
test: rename_table
test: pgfincore
test: rename_table test_plsql_core
# debug instrument
test: test_debug5

View File

@ -57,7 +57,7 @@ test: out_param_func
test: gs_dump_tableconstraint
# test AI4DB
test: plpgsql_override_out
test: plpgsql_override_out test_plsql_core
test: plpgsql_sql_with_proc_keyword
test: plsql_show_all_error b_pg_plsql_show_all_error
test: pldeveloper_gs_source
@ -460,4 +460,4 @@ test: alter_table_modify alter_table_modify_ustore alter_table_modify_ltt alter_
# test for empty string in A format database
test: accept_empty_str not_accept_empty_str pg_empty_str accept_empty_copy not_accept_empty_copy
#test: with
#test: with

View File

@ -0,0 +1,12 @@
set plsql_show_all_error to on;
begin
forall i in 1 .. v1.count save exceptions insert into tb values v1(i);
end;
/
create procedure test_plsql_core()
is
begin
forall i in 1 .. v1.count save exceptions insert into tb values v1(i);
end;
/