Re: PL/pgSQL, RAISE and error context

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: PL/pgSQL, RAISE and error context
Дата
Msg-id CAFj8pRBTBffPhyupq462UX8VC8=UewSKn0407UPEu9OCSCjTOA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: PL/pgSQL, RAISE and error context  (Marko Tiikkaja <marko@joh.to>)
Ответы Re: PL/pgSQL, RAISE and error context  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers


2015-04-30 10:24 GMT+02:00 Marko Tiikkaja <marko@joh.to>:
Hi Pavel,

This doesn't seem to be what I thought we had agreed on.  For example:

=# create function barf() returns void as $$ begin raise notice without context 'hello world'; end $$ language plpgsql;
CREATE FUNCTION
=# create function foof() returns void as $$ begin perform barf(); end $$ language plpgsql;
CREATE FUNCTION
=# select foof();
NOTICE:  hello world
CONTEXT:  SQL statement "SELECT barf()"
PL/pgSQL function foof() line 1 at PERFORM

It's not only clear that WITHOUT CONTEXT didn't really work here, but it also had absolutely no effect since the context within barf() is also displayed.

It doesn't look well - because it should be solve by errhidecontext(true)

yes, there is a issue in send_message_to_frontend - this ignore edata->hide_ctx field. After fixing, it working as expected - so this is a bug in implementation of errhidecontext()

should be

                if (edata->context && !edata->hide_ctx)
                {
                        pq_sendbyte(&msgbuf, PG_DIAG_CONTEXT);
                        err_sendstring(&msgbuf, edata->context);
                }

and probably getting stack in err_finish should be fixed too:

        if (!edata->hide_ctx)
                for (econtext = error_context_stack;
                         econtext != NULL;
                         econtext = econtext->previous)
                        (*econtext->callback) (econtext->arg);

Regards

Pavel



I'll look on this issue.

Regards

Pavel
 


.m

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

Предыдущее
От: Marko Tiikkaja
Дата:
Сообщение: Re: PL/pgSQL, RAISE and error context
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: PL/pgSQL, RAISE and error context