Re: Improve error handling in pltcl

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: Improve error handling in pltcl
Дата
Msg-id CAFj8pRBCjYg1EQf5zy6GEkbogj_EEsXAtzihajgDH8ZAUgYeaw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Improve error handling in pltcl  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: Improve error handling in pltcl  (Robert Haas <robertmhaas@gmail.com>)
Re: Improve error handling in pltcl  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Список pgsql-hackers
Hi

I am testing behave, and some results looks strange

postgres=# \sf foo
CREATE OR REPLACE FUNCTION public.foo()
 RETURNS void
 LANGUAGE plpgsql
AS $function$
begin
  raise exception sqlstate 'ZZ666' using message='hello, world', detail='hello, my world', hint = 'dont afraid';
end
$function$

postgres=# select tcl_eval('spi_exec "select foo();"');
ERROR:  38000: hello, world
CONTEXT:  hello, world   <<<<==========???????

the message was in context. Probably it is out of scope of this patch, but it isn't consistent with other PL


    while executing
"spi_exec "select foo();""
    ("eval" body line 1)
    invoked from within
"eval $1"
    (procedure "__PLTcl_proc_16864" line 3)
    invoked from within
"__PLTcl_proc_16864 {spi_exec "select foo();"}"
in PL/Tcl function "tcl_eval"
LOCATION:  throw_tcl_error, pltcl.c:1217
Time: 1.178 ms

postgres=# select tcl_eval('join $::errorCode "\n"');
                tcl_eval                
═════════════════════════════════════════
 POSTGRES                               ↵
 message                                ↵
 hello, world                           ↵
 detail                                 ↵
 hello, my world                        ↵
 hint                                   ↵
 dont afraid                            ↵
 domain                                 ↵
 plpgsql-9.6                            ↵
 context_domain                         ↵
 postgres-9.6                           ↵
 context                                ↵
 PL/pgSQL function foo() line 3 at RAISE↵
 SQL statement "select foo();"          ↵
 cursor_position                        ↵
 0                                      ↵
 filename                               ↵
 pl_exec.c                              ↵
 lineno                                 ↵
 3165                                   ↵
 funcname                               ↵
 exec_stmt_raise
(1 row)

I miss a SQLSTATE.

Why is used List object instead dictionary? TCL supports it https://www.tcl.tk/man/tcl8.5/tutorial/Tcl23a.html

Regards

Pavel

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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: TAP / recovery-test fs-level backups, psql enhancements etc
Следующее
От: Tom Lane
Дата:
Сообщение: Re: WIP: Upper planner pathification