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 18:22:49
Message-ID: 22687.1374776569@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:
> * Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)us) wrote:
>> If you want I'll draft something up.

> I'll take care of it, thanks for the idea!

OK. One possibly non-obvious point is that I think the field should be
defined as "context containing associated non-constant strings"; this
would mean in particular that CopyErrorData would need to change it
to CurrentMemoryContext in the copied struct, and then ReThrowError
would change it back when restoring the data onto the error stack.
This detail is probably a no-op in current usages, but in the future it
might allow modification of a copied ErrorData while it's outside
ErrorContext, if anyone should want to do that.

Also I'd advise declaring the field as "struct MemoryContextData *"
to avoid having to include palloc.h into elog.h.

regards, tom lane

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2013-07-25 18:31:52 pgsql: Don't use SnapshotNow in get_actual_variable_range.
Previous Message Stephen Frost 2013-07-25 18:04:40 Re: pgsql: Add GET DIAGNOSTICS ... PG_CONTEXT in PL/PgSQL

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2013-07-25 19:44:54 Re: Review: UNNEST (and other functions) WITH ORDINALITY
Previous Message Stephen Frost 2013-07-25 18:04:40 Re: pgsql: Add GET DIAGNOSTICS ... PG_CONTEXT in PL/PgSQL