Fix assertion failure in job_stat error handling

Since CopyErrorData asserts that the current MemoryContext is not
ErrorContext we need to make sure to switch context before copying
ErrorData.
This commit is contained in:
Sven Klemm 2020-08-24 10:47:17 +02:00 committed by Sven Klemm
parent 8e1e6036af
commit 58b4622346

View File

@ -238,6 +238,7 @@ calculate_next_start_on_failure(TimestampTz finish_time, int consecutive_failure
}
PG_CATCH();
{
MemoryContextSwitchTo(oldctx);
ErrorData *errdata = CopyErrorData();
ereport(LOG,
(errcode(ERRCODE_INTERNAL_ERROR),
@ -247,7 +248,7 @@ calculate_next_start_on_failure(TimestampTz finish_time, int consecutive_failure
RollbackAndReleaseCurrentSubTransaction();
}
PG_END_TRY();
MemoryContextSwitchTo(oldctx);
Assert(CurrentMemoryContext == oldctx);
if (!res_set)
{
TimestampTz nowt;