diff --git a/src/common/pl/plpgsql/src/gram.y b/src/common/pl/plpgsql/src/gram.y index fe3217956..f87a40837 100755 --- a/src/common/pl/plpgsql/src/gram.y +++ b/src/common/pl/plpgsql/src/gram.y @@ -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]; diff --git a/src/test/regress/expected/test_plsql_core.out b/src/test/regress/expected/test_plsql_core.out new file mode 100644 index 000000000..a91dd2afb --- /dev/null +++ b/src/test/regress/expected/test_plsql_core.out @@ -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 diff --git a/src/test/regress/parallel_schedule0 b/src/test/regress/parallel_schedule0 index f7f9846b4..8a1a799b5 100644 --- a/src/test/regress/parallel_schedule0 +++ b/src/test/regress/parallel_schedule0 @@ -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 diff --git a/src/test/regress/parallel_schedule0A b/src/test/regress/parallel_schedule0A index 7582f49de..7ef668d0b 100644 --- a/src/test/regress/parallel_schedule0A +++ b/src/test/regress/parallel_schedule0A @@ -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 \ No newline at end of file +#test: with diff --git a/src/test/regress/sql/test_plsql_core.sql b/src/test/regress/sql/test_plsql_core.sql new file mode 100644 index 000000000..a5068c40f --- /dev/null +++ b/src/test/regress/sql/test_plsql_core.sql @@ -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; +/