diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index 155d8519a74..30a3a1e698e 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -96,6 +96,10 @@ ErrorContextCallback *error_context_stack = NULL; sigjmp_buf *PG_exception_stack = NULL; +/* BEGIN_NEON */ +SqlErrorCode_hook_type SqlErrorCode_hook = NULL; +/* END_NEON */ + extern bool redirection_done; /* @@ -857,6 +861,11 @@ matches_backtrace_functions(const char *funcname) int errcode(int sqlerrcode) { +/* BEGIN_NEON */ + if (SqlErrorCode_hook != NULL) { + SqlErrorCode_hook(sqlerrcode); + } +/* END_NEON */ ErrorData *edata = &errordata[errordata_stack_depth]; /* we don't bother incrementing recursion_depth */ diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h index 8bb55e5b3cc..20892425967 100644 --- a/src/include/utils/elog.h +++ b/src/include/utils/elog.h @@ -429,6 +429,11 @@ extern PGDLLIMPORT ErrorContextCallback *error_context_stack; extern PGDLLIMPORT sigjmp_buf *PG_exception_stack; +/* BEGIN_HADRON */ +typedef void (*SqlErrorCode_hook_type) (int sqlerrcode); +extern PGDLLIMPORT SqlErrorCode_hook_type SqlErrorCode_hook; +/* END_HADRON */ + /* Stuff that error handlers might want to use */