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

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, "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:03:41
Message-ID: CAOuzzgo3KbxAyWcorDxKPRSy9nEE_X659O8fSEeFFGPjWnhWGw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Tom,

On Wednesday, July 24, 2013, Tom Lane wrote:

> Stephen Frost <sfrost(at)snowman(dot)net <javascript:;>> writes:
> > Add GET DIAGNOSTICS ... PG_CONTEXT in PL/PgSQL
>
> I don't find it to be a terribly good idea that GetErrorContextStack
> does FlushErrorState(). Doesn't that imply that it can't safely be
> used from inside error processing, which is more or less exactly
> where it is intended to be used? I would certainly think it surprising
> that that call destroys all information about the error.

It's not intended (nor allowed, if I got it right) in an error context. I
will admit that it's not a wonderful situation to have it using the error
handling's internal components like this, but that's also where it has to
go for the callbacks to get the information needed.

> For the same reason, it's rather dubious that it uses ErrorContext as
> working space. There might not be a heck of a lot of space left there,
> and I don't think that construction of this string really counts as
> error processing. It seems to me to be something done outside the error
> subsystem.
>

My concerns and thoughts around this were what may happen if a callback
throws an error and it still makes me a bit nervous but It seems like it
should work. Still, if there's a reasonable way to collect the stack info
without going through the error callbacks, without implementing a duplicate
system, I'm all ears.

Thanks!

Stephen

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2013-07-25 03:12:00 Re: pgsql: Add GET DIAGNOSTICS ... PG_CONTEXT in PL/PgSQL
Previous Message Tom Lane 2013-07-25 02:33:58 Re: pgsql: Add GET DIAGNOSTICS ... PG_CONTEXT in PL/PgSQL

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2013-07-25 03:12:00 Re: pgsql: Add GET DIAGNOSTICS ... PG_CONTEXT in PL/PgSQL
Previous Message Tom Lane 2013-07-25 02:33:58 Re: pgsql: Add GET DIAGNOSTICS ... PG_CONTEXT in PL/PgSQL