Re: proposal: use errcontext for custom exception too

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: proposal: use errcontext for custom exception too
Дата
Msg-id CAFj8pRA+aryN-0kn58KN7kf1f8W1aTKntvtEdVXNrzOFmnJ5Qw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: proposal: use errcontext for custom exception too  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
2011/11/25 Tom Lane <tgl@sss.pgh.pa.us>:
> Robert Haas <robertmhaas@gmail.com> writes:
>> On Thu, Nov 24, 2011 at 12:30 PM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
>>> There are small issue in PL/pgSQL and custom exceptions. Custom
>>> exception doesn't set a CONTEXT field. I propose change this behave
>>> for WARNING or EXCEPTION level. The goal is same behave for custom
>>> exception and builtin exception and it can help to identify a RAISE
>>> statement that is responsible to exception.
>
>> That seems completely arbitrary.  I think we discussed before
>> providing an option to allow the user to control this, which seems
>> better than implementing some hardcoded rule that may or may not be
>> what a given user wants.
>
> Note also that the current behavior *is* what people want; at least,
> we have seen no field complaints about the lack of first-level CONTEXT
> for RAISE notices, and plenty of complaints from people who think
> there's still too much cruft automatically attached to RAISE output.
> If anything, what's been requested is a way to suppress even more
> context, not a policy decision to force more of it.
>

People usually don't like verbose output in interactive mode in
console. CONTEXT for RAISE NOTICE is not necessary.  If you have a
small functions, then CONTEXT for RAISE EXCEPTION is not necessary
too. But if you have a functions with hundreds lines, then more
informations about origin of exception is welcome. There is workaround
- with one statement function (RAISE stmt wrapper) I have a expected
behave - but it's not clean RAISE EXCEPTION 'some message' is more
readable than PERFORM elog('some message', ..) and log is not too
readable too.

postgres=# SELECT yyy();
CONTEXT:  SQL statement "SELECT xxx()"
PL/pgSQL function "yyy" line 3 at PERFORM

I can understand to motivation decrease verbosity, but there is clean
request "simply identification a source of exception (exception, not
notification)". Some RAISE stmt option should be - but for NOTICE
level NO_CONTEXT is optimal, and for EXCEPTION NO_CONTEXT is
suboptimal. It has sense just for WARNING level.

Regards

Pavel


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: proposal: use errcontext for custom exception too
Следующее
От: Jeff Janes
Дата:
Сообщение: Re: [PATCH] optional cleaning queries stored in pg_stat_statements