Re: PL/pgSQL, RAISE and error context

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Marko Tiikkaja <marko(at)joh(dot)to>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Merlin Moncure <mmoncure(at)gmail(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PL/pgSQL, RAISE and error context
Date: 2015-04-23 08:56:00
Message-ID: CAFj8pRDh56TkAsPFpP4xxpf+mLdmsgvafYKM2t2KU7cKb9XzrQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2015-04-23 9:53 GMT+02:00 Marko Tiikkaja <marko(at)joh(dot)to>:

> On 4/2/15 9:37 AM, Pavel Stehule wrote:
>
>> estate->err_text = stmt->elog_level == ERROR ? estate->err_text :
>>> raise_skip_msg ;
>>>
>>
>> Can we do this simple change? It will produce a stackinfo for exceptions
>> and it will not to make mad developers by lot of useless content.
>>
>
> I'm not sure everyone agrees with this to be honest, myself included.
>
> I think the best way to do this would be to have an option for RAISE to
> suppress the context *regardless of nesting depth*, but show the full
> context by default for ERRORs. For NOTICEs and WARNINGs I don't care much
> what the default will be; perhaps just full backwards compatibility could
> work there.
>

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.

I am not to against to any special option to RAISE statement. Have you some
idea?

What about a enhancing a USING clause?

example:

RAISE NOTICE USING message = '', with_context = true
RAISE EXCEPTION USING message = '', with_context = false

Regards

Pavel

>
>
> .m
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2015-04-23 09:22:27 Re: [BUGS] Failure to coerce unknown type to specific type
Previous Message David G. Johnston 2015-04-23 08:49:38 Re: [BUGS] Failure to coerce unknown type to specific type