From 7fb3295812398f5a70f3b48f89d4b252b05755c4 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Thu, 31 Aug 2017 11:39:18 -0700
Subject: [PATCH 13/16] WIP: Make scan desc available for all PlanStates.

This is to allow JITing tuple deforming.
---
 src/backend/executor/execTuples.c | 1 +
 src/include/nodes/execnodes.h     | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/src/backend/executor/execTuples.c b/src/backend/executor/execTuples.c
index 8280b89f7f..78ec871f50 100644
--- a/src/backend/executor/execTuples.c
+++ b/src/backend/executor/execTuples.c
@@ -866,6 +866,7 @@ ExecInitScanTupleSlot(EState *estate, ScanState *scanstate, TupleDesc tupledesc)
 {
 	scanstate->ss_ScanTupleSlot = ExecAllocTableSlot(&estate->es_tupleTable,
 													 tupledesc);
+	scanstate->ps.scandesc = tupledesc;
 }
 
 /* ----------------
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index bc5874f1ee..b0c4856392 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -869,6 +869,9 @@ typedef struct PlanState
 	ExprState  *qual;			/* boolean qual condition */
 	struct PlanState *lefttree; /* input plan tree(s) */
 	struct PlanState *righttree;
+
+	TupleDesc scandesc;
+
 	List	   *initPlan;		/* Init SubPlanState nodes (un-correlated expr
 								 * subselects) */
 	List	   *subPlan;		/* SubPlanState nodes in my expressions */
-- 
2.14.1.2.g4274c698f4.dirty

