Skip to content

Commit a5625e7

Browse files
authored
Reset error context in debug injection points (#9741)
Otherwise it can inherit error details from the current error context, like location information during parsing. This leads to flaky error messages.
1 parent 194f405 commit a5625e7

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/debug_point.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,12 @@ ts_debug_point_raise_error_if_enabled(const char *name)
301301
break;
302302
}
303303

304+
/*
305+
* Drop error context, so that the error description doesn't inherit details
306+
* from the surrounding context (i.e. parse location).
307+
*/
308+
error_context_stack = NULL;
309+
304310
ereport(ERROR,
305311
(errcode(ERRCODE_TRIGGERED_ACTION_EXCEPTION),
306312
errmsg("error injected at debug point '%s'", point.name)));
@@ -338,6 +344,13 @@ ts_debug_point_raise_error_oneshot(const char *name)
338344
}
339345

340346
debug_point_release(&point);
347+
348+
/*
349+
* Drop error context, so that the error description doesn't inherit details
350+
* from the surrounding context (i.e. parse location).
351+
*/
352+
error_context_stack = NULL;
353+
341354
ereport(ERROR,
342355
(errcode(ERRCODE_TRIGGERED_ACTION_EXCEPTION),
343356
errmsg("error injected at debug point '%s'", point.name)));

0 commit comments

Comments
 (0)