Re: [COMMITTERS] 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: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [COMMITTERS] pgsql: Add GET DIAGNOSTICS ... PG_CONTEXT in PL/PgSQL
Date: 2013-07-29 03:13:34
Message-ID: 20130729031334.GC15510@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Tom,

* Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)us) wrote:
> 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.

Good points, all. Apologies for it taking a bit to get to this, but
please take a look when you get a chance. Barring objections, this is
what I'm planning to commit, which moves most calls to use the new
edata->alloc_context instead of ErrorContext. This also means we can
allow GET DIAG ... PG_CONTEXT to be called from exception handlers,
which I've set up and added regression tests for.

Thanks!

Stephen

Attachment Content-Type Size
error_context_rework.patch text/x-diff 22.1 KB

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2013-07-29 14:43:26 pgsql: Fix contrib/cube and contrib/seg to build with bison 3.0.
Previous Message Peter Eisentraut 2013-07-28 11:20:47 pgsql: Message style improvements

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Dunstan 2013-07-29 03:29:27 Evaluate arbitrary expression on tuple inside trigger function?
Previous Message Tom Lane 2013-07-29 02:49:04 Re: ALTER SYSTEM SET command to change postgresql.conf parameters (RE: Proposal for Allow postgresql.conf values to be changed via SQL [review])