avoid-dereference-plan_node_id-if-no-dsm-area.patch

application/octet-stream

Filename: avoid-dereference-plan_node_id-if-no-dsm-area.patch
Type: application/octet-stream
Part: 1
Message: Assorted style changes with a tiny improvement

Patch

Format: unified
File+
src/backend/executor/nodeHashjoin.c 2 1
diff --git a/src/backend/executor/nodeHashjoin.c b/src/backend/executor/nodeHashjoin.c
index dbf114cd5e..0e25de9c9f 100644
--- a/src/backend/executor/nodeHashjoin.c
+++ b/src/backend/executor/nodeHashjoin.c
@@ -1549,7 +1549,7 @@ ExecHashJoinEstimate(HashJoinState *state, ParallelContext *pcxt)
 void
 ExecHashJoinInitializeDSM(HashJoinState *state, ParallelContext *pcxt)
 {
-	int			plan_node_id = state->js.ps.plan->plan_node_id;
+	int			plan_node_id;
 	HashState  *hashNode;
 	ParallelHashJoinState *pstate;
 
@@ -1566,6 +1566,7 @@ ExecHashJoinInitializeDSM(HashJoinState *state, ParallelContext *pcxt)
 	 * Set up the state needed to coordinate access to the shared hash
 	 * table(s), using the plan node ID as the toc key.
 	 */
+	plan_node_id = state->js.ps.plan->plan_node_id;
 	pstate = shm_toc_allocate(pcxt->toc, sizeof(ParallelHashJoinState));
 	shm_toc_insert(pcxt->toc, plan_node_id, pstate);