Re: PL/pgSQL, RAISE and error context - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: PL/pgSQL, RAISE and error context
Date
Msg-id CAFj8pRCbUr_4evv-h0_cPZZEb-JLzhH7_to26b+g0u8gWzxrOg@mail.gmail.com
Whole thread Raw
In response to Re: PL/pgSQL, RAISE and error context  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: PL/pgSQL, RAISE and error context
List pgsql-hackers


2015-04-23 16:12 GMT+02:00 Robert Haas <robertmhaas@gmail.com>:
On Thu, Apr 23, 2015 at 9:55 AM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
>> On Thu, Apr 23, 2015 at 4:56 AM, Pavel Stehule <pavel.stehule@gmail.com>
>> wrote:
>> > I don't see a contradiction. There is clean agreement, so ERROR level
>> > should
>> > to show the context. NOTICE and WARNINGs doesn't need it - and there is
>> > a
>> > backward compatibility and usability reasons don't do it.
>>
>> Whether notices and warnings need it is a matter of opinion.  I don't
>> think your idea is bad, and it might be a good rule of thumb in many
>> cases, but I slightly prefer Marko's approach of adding a new option.
>
> I am not sure if I understand to you.
>
> please, can you write more about your idea?

Your idea, as I understand it, is that for logs at severity levels
lower than ERROR, we can always emit the context, because it's not
necessary.  But I'm not sure that's right: some people might find that
context helpful.  If, as Marko proposes, we add an explicit option,
then everyone can choose the behavior that is right for them.

I am not sure, if explained it well. I would to emit context for ERROR and higher by default. And I would not to emit context for any less than ERROR by default (I am not sure about WARNING level).

But it can be changed by some option in RAISE statement like Marko proposes - possible to change by GUC globally, because it doesn't change a behave of application.

For current behave I have a problem with ERROR level in plpgsql where the context is missing now.  On second hand I am thinking so current behave is ok for NOTICE level .

I am not against to any new option in RAISE statement.

If there is some collision between me and Marko, then it is in opinion what have to be default behave for NOTICE level. I strongly prefer don't show context there. But I can accept some global switch too.

Regards

Pavel
 

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

pgsql-hackers by date:

Previous
From: Jim Nasby
Date:
Subject: Re: tablespaces inside $PGDATA considered harmful
Next
From: Heikki Linnakangas
Date:
Subject: Re: Freeze avoidance of very large table.