Re: Why doesn't `RAISE EXCEPTION` provide error context?

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Taytay <taylor(at)youneedabudget(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Why doesn't `RAISE EXCEPTION` provide error context?
Date: 2015-04-02 08:05:56
Message-ID: CAFj8pRAvZjN4boA6+O=ofHt99Y_L+2fF6jxHfK2h86Knv9tNjQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

The OP on this thread has introduced a potential compromise. Keep the
> current printing behavior for RAISE but the construction of the error
> itself should contain all of the relevant detail so that the caller can get
> to the suppressed information via, in this instance, GET STACKED
> DIAGNOSTICS inside an exception handler - a situation where the error is in
> context but has not yet been printed.
>
> Giving the function author the ability, via a new using clause, to bypass
> the printing short-circuit is another feature to consider.
>
> I haven't fully comprehended the design decisions and trade-offs but
> omitting data to facilitate printing doesn't sound like an appropriate
> solution - not that I have any clue how hard it would be separate the two
> aspects. Likewise with adding in a short-circuit that is judgemental
> without providing some means to bypass it. We are not talking about data
> integrity or performance here and while I'll admit reducing verbosity is a
> valid goal mis-use of a provided work-around mechanic is not that serious a
> transgression and one readily noticed and somewhat readily corrected.
>

There is more aspects - current behave is too simply fix - but it works
almost time. We can enhance a RAISE statement, but default behave should be
practical. Usually we don't need stack for NOTICE level (and maybe for
WARNING level) and usually we would to have stack for EXCEPTION level. Now,
there is workaround due GET DIAGNOSTICS STACK, but it is workaround - and
the enhancing of GET DIAGNOSTICS was not designed for this purpose. Sure,
there are more variant of fixing - and we can implement more than one.

Regards

Pavel

>
> David J.
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Geoff Winkless 2015-04-02 11:07:35 implicit CAST on CSV COPY FROM
Previous Message David G. Johnston 2015-04-02 07:53:13 Re: Why doesn't `RAISE EXCEPTION` provide error context?