diff options
| author | Stephen Frost | 2013-08-01 05:07:20 +0000 |
|---|---|---|
| committer | Stephen Frost | 2013-08-01 05:07:20 +0000 |
| commit | ddef1a39c6798ffae899acd08ff92329dd304085 (patch) | |
| tree | 9a83029259e527fa3f6b978f112b1782ea2b600d /src/pl | |
| parent | a59516b6311a6c2acc89448c94913ebae598f02a (diff) | |
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.
Diffstat (limited to 'src/pl')
| -rw-r--r-- | src/pl/plpgsql/src/pl_gram.y | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/pl/plpgsql/src/pl_gram.y b/src/pl/plpgsql/src/pl_gram.y index 263abeff44..325d7566d3 100644 --- a/src/pl/plpgsql/src/pl_gram.y +++ b/src/pl/plpgsql/src/pl_gram.y @@ -895,7 +895,6 @@ stmt_getdiag : K_GET getdiag_area_opt K_DIAGNOSTICS getdiag_list ';' /* these fields are disallowed in stacked case */ case PLPGSQL_GETDIAG_ROW_COUNT: case PLPGSQL_GETDIAG_RESULT_OID: - case PLPGSQL_GETDIAG_CONTEXT: if (new->is_stacked) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), @@ -921,6 +920,9 @@ stmt_getdiag : K_GET getdiag_area_opt K_DIAGNOSTICS getdiag_list ';' plpgsql_getdiag_kindname(ditem->kind)), parser_errposition(@1))); break; + /* these fields are allowed in either case */ + case PLPGSQL_GETDIAG_CONTEXT: + break; default: elog(ERROR, "unrecognized diagnostic item kind: %d", ditem->kind); |
