mirror of
https://github.com/postgres/postgres.git
synced 2025-07-15 19:21:59 +03:00
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.
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user