Re: pgsql: Add GET DIAGNOSTICS ... PG_CONTEXT in PL/PgSQL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: "pgsql-committers(at)postgresql(dot)org" <pgsql-committers(at)postgresql(dot)org>
Subject: Re: pgsql: Add GET DIAGNOSTICS ... PG_CONTEXT in PL/PgSQL
Date: 2013-07-25 03:19:25
Message-ID: 26325.1374722365@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Stephen Frost <sfrost(at)snowman(dot)net> writes:
> That said, I'll work on making this more independent of the error handling
> and see if it can be made to use an independent memory context and try to
> tighten it up to ensure it isn't called in an error case. Future callers
> may try to.

I'm not following your reasoning here. This *has* to be called in an
error case, before you're outside the error processing context.
Otherwise there would be no data available to be printed.

In short: FlushErrorState, by definition, destroys the information that
GetErrorContextStack looks at. So in the current implementation,
GetErrorContextStack is burning its bridges behind it. That's at the
very least a surprising behavior. I am betting that it will have
unpleasant consequences for any sort of nested-error scenario.

regards, tom lane

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Stephen Frost 2013-07-25 03:36:08 Re: pgsql: Add GET DIAGNOSTICS ... PG_CONTEXT in PL/PgSQL
Previous Message Stephen Frost 2013-07-25 03:13:31 Re: pgsql: Add GET DIAGNOSTICS ... PG_CONTEXT in PL/PgSQL

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2013-07-25 03:36:08 Re: pgsql: Add GET DIAGNOSTICS ... PG_CONTEXT in PL/PgSQL
Previous Message Stephen Frost 2013-07-25 03:13:31 Re: pgsql: Add GET DIAGNOSTICS ... PG_CONTEXT in PL/PgSQL