Re: proposal: enhanced get diagnostics statement

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: proposal: enhanced get diagnostics statement
Дата
Msg-id BANLkTimoYH4puJy-C1Ep80Tiom7Rfg4JDA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: proposal: enhanced get diagnostics statement  (Alvaro Herrera <alvherre@commandprompt.com>)
Список pgsql-hackers
2011/5/21 Alvaro Herrera <alvherre@commandprompt.com>:
> Excerpts from Pavel Stehule's message of sáb may 21 16:05:01 -0400 2011:
>
>> A implementation of ERROR_CONTEXT is not without impact on
>> performance, because context should be collected when exception is
>> caught. One solution is removing a ERROR_CONTEXT from proposal. Second
>> solution can be a design of enhanced syntax for exception trap like
>> (it means - collect CONTEXT when exception is handled)
>
> I don't understand why we should worry about this.  I mean, if you don't
> catch the error, you have to form errcontext anyway.  Why is it a
> problem to generate it when the exception is caught?

Generating context means a calling a few functions with some string
operations - because in this moment is limited functionality, there
isn't too much operations - but it can be changed - PL/PSM dumps all
local variables, ...

somebody uses a exception trapping like mechanism for ignoring errors

FOR r IN SELECT ..
LOOP BEGIN   INSERT INTO ... EXCEPTION WHEN OTHERS THEN   /* do nothing */ END;
END LOOP;

or some body can do

BEGIN ...
EXCEPTION WHEN OTHERS THEN RAISE WARNING ' .....'; RAISE;
END;

In last case the context can wanted - so it cannot be hard problem.
But first case is problem and we has not different way how to do it.

Maybe we can use a simple optimization

when function doesn't contain a GET DIAGNOSTICS statement with
ERROR_CONTEXT field, then we can not collect a context. Only when
function has GET DIAGNOSTICS with ERROR_CONTEXT we will take context
info. This strategy ensure, so there will not be negative performance
effect on current applications.

Pavel

>
> --
> Álvaro Herrera <alvherre@commandprompt.com>
> The PostgreSQL Company - Command Prompt, Inc.
> PostgreSQL Replication, Consulting, Custom Development, 24x7 support
>


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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: about EDITOR_LINENUMBER_SWITCH
Следующее
От: Marios Vodas
Дата:
Сообщение: Compile plPython for Python 3.2