From 7832090f9b2c5f92ba3ff15ab15b510afafde704 Mon Sep 17 00:00:00 2001 From: Julong-Li <584147810@qq.com> Date: Thu, 27 Jul 2023 16:14:24 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=8C=BF=E5=90=8D=E5=9D=97?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E6=95=B0=E6=8D=AE=E5=BA=93=E5=AE=95=E6=9C=BA?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/pl/plpgsql/src/gram.y | 1 + src/test/regress/expected/test_plsql_core.out | 35 +++++++++++++++++++ src/test/regress/parallel_schedule0 | 4 +-- src/test/regress/parallel_schedule0A | 4 +-- src/test/regress/sql/test_plsql_core.sql | 12 +++++++ 5 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 src/test/regress/expected/test_plsql_core.out create mode 100644 src/test/regress/sql/test_plsql_core.sql 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; +/