pgsql: Improvements to GetErrorContextStack()

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Improvements to GetErrorContextStack()
Date: 2013-07-25 13:51:37
Message-ID: E1V2LxB-0001sn-9A@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Improvements to GetErrorContextStack()

As GetErrorContextStack() borrowed setup and tear-down code from other
places, it was less than clear that it must only be called as a
top-level entry point into the error system and can't be called by an
exception handler (unlike the rest of the error system, which is set up
to be reentrant-safe).

Being called from an exception handler is outside the charter of
GetErrorContextStack(), so add a bit more protection against it,
improve the comments addressing why we have to set up an errordata
stack for this function at all, and add a few more regression tests.

Lack of clarity pointed out by Tom Lane; all bugs are mine.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/9bd0feeba85fae411e01798d5a5d76b70333e38e

Modified Files
--------------
src/backend/utils/error/elog.c | 50 +++++++++++++++++++-------
src/test/regress/expected/plpgsql.out | 62 +++++++++++++++++++++++++++------
src/test/regress/sql/plpgsql.sql | 18 ++++++++--
3 files changed, 105 insertions(+), 25 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Stephen Frost 2013-07-25 14:02:38 Re: pgsql: Add GET DIAGNOSTICS ... PG_CONTEXT in PL/PgSQL
Previous Message Stephen Frost 2013-07-25 04:39:49 Re: pgsql: Add GET DIAGNOSTICS ... PG_CONTEXT in PL/PgSQL