Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions copy_pg_error.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "copy_pg_error.h"
#include "nodes/nodeFuncs.h"

Error copy_pg_error() {
MemoryContext mem = AllocSetContextCreate(
Expand All @@ -18,3 +19,14 @@ Error copy_pg_error() {
};
return error;
}

bool wrapped_raw_expression_tree_walker_impl(Node *n, tree_walker_callback w, void *c, Error *error) {
bool result;
PG_TRY();
result = raw_expression_tree_walker_impl(n, w, c);
PG_CATCH();
*error = copy_pg_error();
result = true;
PG_END_TRY();
return result;
}
13 changes: 3 additions & 10 deletions wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,9 @@ static inline MemoryContext get_top_memory_context(void) {
return TopMemoryContext;
}

static inline bool wrapped_raw_expression_tree_walker_impl(Node *n, tree_walker_callback w, void *c, Error *error) {
bool result;
PG_TRY();
result = raw_expression_tree_walker_impl(n, w, c);
PG_CATCH();
*error = copy_pg_error();
result = true;
PG_END_TRY();
return result;
}
// Moved definition into copy_pg_error.c.
// Rust links against this symbol directly, so it needs external linkage.
bool wrapped_raw_expression_tree_walker_impl(Node *n, tree_walker_callback w, void *c, Error *error);

static inline StringInfo wrapped_raw_deparse(RawStmt *stmt, ErrorData **error) {
StringInfo str;
Expand Down
Loading