[BUGS] BUG #14861: Handle syntax_error

Поиск
Список
Период
Сортировка
От andrey_shvidky@hotmail.com
Тема [BUGS] BUG #14861: Handle syntax_error
Дата
Msg-id 20171018153220.8201.15631@wrigleys.postgresql.org
обсуждение исходный текст
Ответы Re: [BUGS] BUG #14861: Handle syntax_error
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      14861
Logged by:          Andrey Shvidky
Email address:      andrey_shvidky@hotmail.com
PostgreSQL version: 9.6.5
Operating system:   Windows 7 x64
Description:

/*
Faced with such a unfairness.
I have a do block or function with error handling block.
In case when error type is 42601 (syntax_error) I can't get correct error
context.
The error context contains information about do block or function itself,
but not about last executed instruction.
In the folowing example, if I remove error handling I will happily have such
a message:

ERROR: subquery must return only one column
LINE 1: SELECT (select id, val1 from aaa)
But in case when error handling presents I have only sad:

message_text = subquery must return only one column
pg_exception_context = PL/pgSQL function inline_code_block line 9 at
assignment
pg_exception_detail =

Where information about "SELECT (select id, val1 from aaa)" hided?
Repro script:
*/

create temp table aaa (id int, val1 text);

do language plpgsql $$
declareerror_message            text;error_detailed_message    text;error_context            text;arr_test
 aaa[];
 
begin--arr_test = (select row(id, val1) from aaa);        -- No error, correct callarr_test = (select id, val1 from
aaa);           -- Error 42601 syntax_error 
 
exception--when syntax_error thenwhen others then    get stacked diagnostics        error_message = message_text
  ,error_context = pg_exception_context        ,error_detailed_message = pg_exception_detail;
 
    raise notice 'message_text = %', error_message;    raise notice 'pg_exception_context = %', error_context;
raisenotice 'pg_exception_detail = %', error_detailed_message;
 
end
$$;

drop table if exists aaa;


--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [BUGS] Improper const-evaluation of HAVING with grouping sets and subquery pullup
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [BUGS] Improper const-evaluation of HAVING with grouping sets and subquery pullup