pgsql: Add GET DIAGNOSTICS ... PG_CONTEXT in PL/PgSQL

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Add GET DIAGNOSTICS ... PG_CONTEXT in PL/PgSQL
Date: 2013-07-24 23:03:24
Message-ID: E1V285c-0004mP-MD@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Add GET DIAGNOSTICS ... PG_CONTEXT in PL/PgSQL

This adds the ability to get the call stack as a string from within a
PL/PgSQL function, which can be handy for logging to a table, or to
include in a useful message to an end-user.

Pavel Stehule, reviewed by Rushabh Lathia and rather heavily whacked
around by Stephen Frost.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/831283256796d1c20858862b568d73e505eb4a84

Modified Files
--------------
doc/src/sgml/plpgsql.sgml | 57 +++++++++++++++++++++++++++
src/backend/utils/error/elog.c | 69 +++++++++++++++++++++++++++++++++
src/include/utils/elog.h | 2 +
src/pl/plpgsql/src/pl_exec.c | 10 +++++
src/pl/plpgsql/src/pl_funcs.c | 2 +
src/pl/plpgsql/src/pl_gram.y | 6 +++
src/pl/plpgsql/src/pl_scanner.c | 1 +
src/pl/plpgsql/src/plpgsql.h | 1 +
src/test/regress/expected/plpgsql.out | 48 +++++++++++++++++++++++
src/test/regress/sql/plpgsql.sql | 33 ++++++++++++++++
10 files changed, 229 insertions(+)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2013-07-25 02:01:59 pgsql: pg_upgrade: fix initialization of thread argument
Previous Message Tom Lane 2013-07-24 21:42:58 pgsql: Improve ilist.h's support for deletion of slist elements during

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2013-07-24 23:05:46 Re: dynamic background workers, round two
Previous Message Michael Paquier 2013-07-24 23:03:17 Re: dynamic background workers, round two