!3367 修复打开plsql_show_all_error后未记录gs_error表的问题

Merge pull request !3367 from chenxiaobin/fixGsError
This commit is contained in:
opengauss-bot
2023-05-06 03:20:58 +00:00
committed by Gitee
4 changed files with 40 additions and 1 deletions

View File

@ -9799,7 +9799,6 @@ make_execsql_stmt(int firsttoken, int location)
HeapTuple rel_tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(rel_oid));
if (!HeapTupleIsValid(rel_tuple)) {
yyerror("invalid type's rel tuple for insert.", true);
u_sess->plsql_cxt.have_error = true;
} else {
plpgsql_append_source_text(&ds, location, values_end_loc);

View File

@ -606,6 +606,7 @@ void plpgsql_yyerror(const char* message, bool isError)
{
char* yytext = u_sess->plsql_cxt.curr_compile_context->core_yy->scanbuf + plpgsql_yylloc;
int errstate = 0;
u_sess->plsql_cxt.have_error = true;
#ifndef ENABLE_MULTIPLE_NODES
if (u_sess->attr.attr_common.plsql_show_all_error && !isError) {
errstate = NOTICE;

View File

@ -1806,4 +1806,31 @@ $$ language plpgsql;
ERROR: unsupported insert into table from non record type. at or near "i"
LINE 6: insert into insert_table values i;
^
truncate dbe_pldeveloper.gs_errors;
create table tab_1139605(id int,a1 int);
create function fun_1139605()return int
as
b int;
begin
select a1 into b,c from tab_1139605 where id=1;
return b;
end;
/
NOTICE: syntax error at or near "from"
LINE 3: select a1 into b,c from tab_1139605 where id=1;
^
QUERY: DECLARE b int;
begin
select a1 into b,c from tab_1139605 where id=1;
return b;
end
ERROR: Debug mod,create procedure has error.
DETAIL: N/A
CONTEXT: compilation of PL/pgSQL function "fun_1139605" near line 2
select count(*) from dbe_pldeveloper.gs_errors;
count
-------
1
(1 row)
set plsql_show_all_error to off;

View File

@ -1177,4 +1177,16 @@ return 1;
end;
$$ language plpgsql;
truncate dbe_pldeveloper.gs_errors;
create table tab_1139605(id int,a1 int);
create function fun_1139605()return int
as
b int;
begin
select a1 into b,c from tab_1139605 where id=1;
return b;
end;
/
select count(*) from dbe_pldeveloper.gs_errors;
set plsql_show_all_error to off;