summaryrefslogtreecommitdiff
path: root/src/include/utils/elog.h
diff options
context:
space:
mode:
authorStephen Frost <sfrost@snowman.net>2013-08-01 01:07:20 -0400
committerStephen Frost <sfrost@snowman.net>2013-08-01 01:07:20 -0400
commitddef1a39c6798ffae899acd08ff92329dd304085 (patch)
tree9a83029259e527fa3f6b978f112b1782ea2b600d /src/include/utils/elog.h
parenta59516b6311a6c2acc89448c94913ebae598f02a (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/include/utils/elog.h')
-rw-r--r--src/include/utils/elog.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h
index add08729ced..6df0d379f4f 100644
--- a/src/include/utils/elog.h
+++ b/src/include/utils/elog.h
@@ -397,6 +397,9 @@ typedef struct ErrorData
int internalpos; /* cursor index into internalquery */
char *internalquery; /* text of internally-generated query */
int saved_errno; /* errno at entry */
+
+ /* context containing associated non-constant strings */
+ struct MemoryContextData *assoc_context;
} ErrorData;
extern void EmitErrorReport(void);