Skip to content

Commit 69db35f

Browse files
author
Oleg Tselebrovskiy
committed
Remove if(MyProc) checks in hooks
1 parent ed9f977 commit 69db35f

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

pg_wait_sampling.c

+7-17
Original file line numberDiff line numberDiff line change
@@ -865,13 +865,9 @@ pgws_planner_hook(Query *parse,
865865
int cursorOptions,
866866
ParamListInfo boundParams)
867867
{
868-
if (MyProc)
869-
{
870-
int i = MyProc - ProcGlobal->allProcs;
871-
if (!pgws_proc_queryids[i])
872-
pgws_proc_queryids[i] = parse->queryId;
873-
874-
}
868+
int i = MyProc - ProcGlobal->allProcs;
869+
if (!pgws_proc_queryids[i])
870+
pgws_proc_queryids[i] = parse->queryId;
875871

876872
/* Invoke original hook if needed */
877873
if (planner_hook_next)
@@ -894,14 +890,9 @@ pgws_planner_hook(Query *parse,
894890
static void
895891
pgws_ExecutorStart(QueryDesc *queryDesc, int eflags)
896892
{
897-
int i;
898-
899-
if (MyProc)
900-
{
901-
i = MyProc - ProcGlobal->allProcs;
902-
if (!pgws_proc_queryids[i])
903-
pgws_proc_queryids[i] = queryDesc->plannedstmt->queryId;
904-
}
893+
int i = MyProc - ProcGlobal->allProcs;
894+
if (!pgws_proc_queryids[i])
895+
pgws_proc_queryids[i] = queryDesc->plannedstmt->queryId;
905896

906897
if (prev_ExecutorStart)
907898
prev_ExecutorStart(queryDesc, eflags);
@@ -915,8 +906,7 @@ pgws_ExecutorStart(QueryDesc *queryDesc, int eflags)
915906
static void
916907
pgws_ExecutorEnd(QueryDesc *queryDesc)
917908
{
918-
if (MyProc)
919-
pgws_proc_queryids[MyProc - ProcGlobal->allProcs] = UINT64CONST(0);
909+
pgws_proc_queryids[MyProc - ProcGlobal->allProcs] = UINT64CONST(0);
920910

921911
if (prev_ExecutorEnd)
922912
prev_ExecutorEnd(queryDesc);

0 commit comments

Comments
 (0)