Skip to content

Commit 58ac3c8

Browse files
committed
When plpgsql_check is loaded due dependency on execution of some function,
then fmgr hook can be installed too late to ensure execution of full sequence of events START, END. So we should to expect so START event can be not executed (first time).
1 parent d939985 commit 58ac3c8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/profiler.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3308,7 +3308,12 @@ plpgsql_check_fmgr_hook(FmgrHookEventType event,
33083308
case FHET_ABORT:
33093309
stack = (fmgr_hook_private *) DatumGetPointer(*private);
33103310

3311-
if (stack->use_plpgsql)
3311+
/*
3312+
* When plpgsql_check is loaded due dependency on some executed function,
3313+
* then FHET_START and FHET_END (or FHET_ABORT) can be assymetric. So
3314+
* stack can be NULL. See issue #101
3315+
*/
3316+
if (stack && stack->use_plpgsql)
33123317
{
33133318
profiler_stack *pstack = top_pinfo->prev_pinfo;
33143319

0 commit comments

Comments
 (0)