Обсуждение: pgsql: Allow a context to be passed in for error handling

Поиск
Список
Период
Сортировка

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

От
Stephen Frost
Дата:
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(-)