pgsql: Allow a context to be passed in for error handling

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Allow a context to be passed in for error handling
Date: 2013-08-01 05:13:37
Message-ID: E1V4lCj-0005rZ-Gv@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Allow a context to be passed in for error handling

As pointed out by Tom Lane, we can allow other users of the error
handler callbacks to provide their own memory context by adding
the context to use to ErrorData and using that instead of explicitly
using ErrorContext.

This then allows GetErrorContextStack() to be called from inside
exception handlers, so modify plpgsql to take advantage of that and
add an associated regression test for it.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/ddef1a39c6798ffae899acd08ff92329dd304085

Modified Files
--------------
src/backend/utils/error/elog.c | 126 ++++++++++++++++-----------------
src/include/utils/elog.h | 3 +
src/pl/plpgsql/src/pl_gram.y | 4 +-
src/test/regress/expected/plpgsql.out | 98 +++++++++++++++++++++++++
src/test/regress/sql/plpgsql.sql | 56 +++++++++++++++
5 files changed, 221 insertions(+), 66 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Stephen Frost 2013-08-01 05:33:12 pgsql: Add locking around SSL_context usage in libpq
Previous Message Noah Misch 2013-08-01 04:22:16 Re: [COMMITTERS] pgsql: Add support for REFRESH MATERIALIZED VIEW CONCURRENTLY.