-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add infrastucture for "soft" error handle
- Loading branch information
Showing
7 changed files
with
258 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/*------------------------------------------------------------------------- | ||
* | ||
* miscnodes.h | ||
* Definitions for hard-to-classify node types. | ||
* | ||
* Node types declared here are not part of parse trees, plan trees, | ||
* or execution state trees. We only assign them NodeTag values because | ||
* IsA() tests provide a convenient way to disambiguate what kind of | ||
* structure is being passed through assorted APIs, such as function | ||
* "context" pointers. | ||
* | ||
* src/include/nodes/miscnodes.h | ||
* | ||
*------------------------------------------------------------------------- | ||
*/ | ||
|
||
#ifndef MISCNODES_H | ||
#define MISCNODES_H | ||
#include "nodes/nodes.h" | ||
|
||
/* | ||
* ErrorSaveContext - | ||
* function call context node for handling of "soft" errors | ||
* | ||
* A caller wishing to trap soft errors must initialize a struct like this | ||
* with all fields zero/NULL except for the NodeTag. Optionally, set | ||
* details_wanted = true if more than the bare knowledge that a soft error | ||
* occurred is required. The struct is then passed to a SQL-callable function | ||
* via the FunctionCallInfo.context field; or below the level of SQL calls, | ||
* it could be passed to a subroutine directly. | ||
* | ||
* After calling code that might report an error this way, check | ||
* error_occurred to see if an error happened. | ||
*/ | ||
typedef struct ErrorSaveContext | ||
{ | ||
NodeTag type; | ||
bool error_occurred; /* set to true if we detect a soft error */ | ||
} ErrorSaveContext; | ||
|
||
/* Often-useful macro for checking if a soft error was reported */ | ||
#define SOFT_ERROR_OCCURRED(escontext) \ | ||
((escontext) != NULL && IsA(escontext, ErrorSaveContext) && \ | ||
((ErrorSaveContext *) (escontext))->error_occurred) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters