@@ -57,47 +57,47 @@ index bc05c96b4c..b6a3abe0d2 100644
5757 if (es->format == EXPLAIN_FORMAT_TEXT)
5858 appendStringInfoChar(es->str, '\n');
5959diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
60- index 682b28ed72..e64ea3ff46 100644
60+ index 682b28ed72..3a5c615deb 100644
6161--- a/src/backend/nodes/copyfuncs.c
6262+++ b/src/backend/nodes/copyfuncs.c
6363@@ -132,6 +132,7 @@ CopyPlanFields(const Plan *from, Plan *newnode)
6464 COPY_NODE_FIELD(initPlan);
6565 COPY_BITMAPSET_FIELD(extParam);
6666 COPY_BITMAPSET_FIELD(allParam);
67- + COPY_NODE_FIELD(private );
67+ + COPY_NODE_FIELD(ext_nodes );
6868 }
6969
7070 /*
7171diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
72- index 7237b52e96..025b4fde2b 100644
72+ index 7237b52e96..5e2ee2732a 100644
7373--- a/src/backend/nodes/outfuncs.c
7474+++ b/src/backend/nodes/outfuncs.c
7575@@ -342,6 +342,7 @@ _outPlanInfo(StringInfo str, const Plan *node)
7676 WRITE_NODE_FIELD(initPlan);
7777 WRITE_BITMAPSET_FIELD(extParam);
7878 WRITE_BITMAPSET_FIELD(allParam);
79- + /*WRITE_NODE_FIELD(private ); */
79+ + /*WRITE_NODE_FIELD(ext_nodes ); */
8080 }
8181
8282 /*
8383diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c
84- index 62c945b6c5..23ab51fb9b 100644
84+ index 62c945b6c5..a39046ca56 100644
8585--- a/src/backend/nodes/readfuncs.c
8686+++ b/src/backend/nodes/readfuncs.c
8787@@ -1580,6 +1580,11 @@ ReadCommonPlan(Plan *local_node)
8888 READ_NODE_FIELD(initPlan);
8989 READ_BITMAPSET_FIELD(extParam);
9090 READ_BITMAPSET_FIELD(allParam);
91- + local_node->private = NIL;
92- + /* READ_NODE_FIELD(private );
91+ + local_node->ext_nodes = NIL;
92+ + /* READ_NODE_FIELD(ext_nodes );
9393+ * Don't serialize this field. It is required to serialize RestrictInfo and
9494+ * EqualenceClass.
9595+ */
9696 }
9797
9898 /*
9999diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
100- index92b5223fee..a533c2cada 100644
100+ index4edc859cb5..988f2e6ab7 100644
101101--- a/src/backend/optimizer/path/costsize.c
102102+++ b/src/backend/optimizer/path/costsize.c
103103@@ -98,6 +98,12 @@
@@ -121,7 +121,7 @@ index 92b5223fee..a533c2cada 100644
121121
122122
123123 /*
124- @@ -4626 ,6 +4631 ,58 @@ approx_tuple_count(PlannerInfo *root, JoinPath *path, List *quals)
124+ @@ -4632 ,6 +4637 ,58 @@ approx_tuple_count(PlannerInfo *root, JoinPath *path, List *quals)
125125 }
126126
127127
@@ -180,7 +180,7 @@ index 92b5223fee..a533c2cada 100644
180180 /*
181181 * set_baserel_size_estimates
182182 *Set the size estimates for the given base relation.
183- @@ -4642 ,19 +4699 ,10 @@ approx_tuple_count(PlannerInfo *root, JoinPath *path, List *quals)
183+ @@ -4648 ,19 +4705 ,10 @@ approx_tuple_count(PlannerInfo *root, JoinPath *path, List *quals)
184184 void
185185 set_baserel_size_estimates(PlannerInfo *root, RelOptInfo *rel)
186186 {
@@ -201,7 +201,7 @@ index 92b5223fee..a533c2cada 100644
201201
202202 cost_qual_eval(&rel->baserestrictcost, rel->baserestrictinfo, root);
203203
204- @@ -4665 ,13 +4713 ,33 @@ set_baserel_size_estimates(PlannerInfo *root, RelOptInfo *rel)
204+ @@ -4671 ,13 +4719 ,33 @@ set_baserel_size_estimates(PlannerInfo *root, RelOptInfo *rel)
205205 * get_parameterized_baserel_size
206206 *Make a size estimate for a parameterized scan of a base relation.
207207 *
@@ -237,7 +237,7 @@ index 92b5223fee..a533c2cada 100644
237237 {
238238 List *allclauses;
239239 doublenrows;
240- @@ -4700 ,6 +4768 ,36 @@ get_parameterized_baserel_size(PlannerInfo *root, RelOptInfo *rel,
240+ @@ -4706 ,6 +4774 ,36 @@ get_parameterized_baserel_size(PlannerInfo *root, RelOptInfo *rel,
241241 * set_joinrel_size_estimates
242242 *Set the size estimates for the given join relation.
243243 *
@@ -274,7 +274,7 @@ index 92b5223fee..a533c2cada 100644
274274 * The rel's targetlist must have been constructed already, and a
275275 * restriction clause list that matches the given component rels must
276276 * be provided.
277- @@ -4719 ,11 +4817 ,11 @@ get_parameterized_baserel_size(PlannerInfo *root, RelOptInfo *rel,
277+ @@ -4725 ,11 +4823 ,11 @@ get_parameterized_baserel_size(PlannerInfo *root, RelOptInfo *rel,
278278 * build_joinrel_tlist, and baserestrictcost is not used for join rels.
279279 */
280280 void
@@ -291,7 +291,7 @@ index 92b5223fee..a533c2cada 100644
291291 {
292292 rel->rows = calc_joinrel_size_estimate(root,
293293 rel,
294- @@ -4739 ,6 +4837 ,35 @@ set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel,
294+ @@ -4745 ,6 +4843 ,35 @@ set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel,
295295 * get_parameterized_joinrel_size
296296 *Make a size estimate for a parameterized scan of a join relation.
297297 *
@@ -327,7 +327,7 @@ index 92b5223fee..a533c2cada 100644
327327 * 'rel' is the joinrel under consideration.
328328 * 'outer_path', 'inner_path' are (probably also parameterized) Paths that
329329 *produce the relations being joined.
330- @@ -4751 ,11 +4878 ,11 @@ set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel,
330+ @@ -4757 ,11 +4884 ,11 @@ set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel,
331331 * set_joinrel_size_estimates must have been applied already.
332332 */
333333 double
@@ -344,7 +344,7 @@ index 92b5223fee..a533c2cada 100644
344344 {
345345 doublenrows;
346346
347- @@ -5424 ,7 +5551 ,7 @@ set_foreign_size_estimates(PlannerInfo *root, RelOptInfo *rel)
347+ @@ -5430 ,7 +5557 ,7 @@ set_foreign_size_estimates(PlannerInfo *root, RelOptInfo *rel)
348348 /* Should only be applied to base relations */
349349 Assert(rel->relid > 0);
350350
@@ -353,7 +353,7 @@ index 92b5223fee..a533c2cada 100644
353353
354354 cost_qual_eval(&rel->baserestrictcost, rel->baserestrictinfo, root);
355355
356- @@ -5710 ,7 +5837 ,7 @@ page_size(double tuples, int width)
356+ @@ -5716 ,7 +5843 ,7 @@ page_size(double tuples, int width)
357357 * Estimate the fraction of the work that each worker will do given the
358358 * number of workers budgeted for the path.
359359 */
@@ -363,7 +363,7 @@ index 92b5223fee..a533c2cada 100644
363363 {
364364 doubleparallel_divisor = path->parallel_workers;
365365diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c
366- indexe445debe57..365b7aa319 100644
366+ index917713c163..5b7bf1cec6 100644
367367--- a/src/backend/optimizer/plan/createplan.c
368368+++ b/src/backend/optimizer/plan/createplan.c
369369@@ -70,6 +70,7 @@
@@ -385,11 +385,11 @@ index e445debe57..365b7aa319 100644
385385 return plan;
386386 }
387387
388- @@ -5162 ,6 +5167 ,7 @@ copy_generic_path_info(Plan *dest, Path *src)
388+ @@ -5163 ,6 +5168 ,7 @@ copy_generic_path_info(Plan *dest, Path *src)
389389 dest->plan_width = src->pathtarget->width;
390390 dest->parallel_aware = src->parallel_aware;
391391 dest->parallel_safe = src->parallel_safe;
392- + dest->private = NIL;
392+ + dest->ext_nodes = NIL;
393393 }
394394
395395 /*
@@ -475,14 +475,14 @@ index 60e7fda6a9..5732c7a685 100644
475475 extra->targetList);
476476
477477diff --git a/src/backend/optimizer/util/relnode.c b/src/backend/optimizer/util/relnode.c
478- index a203e6f1ff..f8db135be0 100644
478+ index a203e6f1ff..d31bf5bae6 100644
479479--- a/src/backend/optimizer/util/relnode.c
480480+++ b/src/backend/optimizer/util/relnode.c
481481@@ -258,6 +258,7 @@ build_simple_rel(PlannerInfo *root, int relid, RelOptInfo *parent)
482482 rel->partexprs = NULL;
483483 rel->nullable_partexprs = NULL;
484484 rel->partitioned_child_rels = NIL;
485- + rel->private = NULL;
485+ + rel->ext_nodes = NULL;
486486
487487 /*
488488 * Pass assorted information down the inheritance hierarchy.
@@ -498,15 +498,15 @@ index a203e6f1ff..f8db135be0 100644
498498 joinrel->partexprs = NULL;
499499 joinrel->nullable_partexprs = NULL;
500500 joinrel->partitioned_child_rels = NIL;
501- + joinrel->private = NULL;
501+ + joinrel->ext_nodes = NULL;
502502
503503 /* Compute information relevant to the foreign relations. */
504504 set_foreign_rel_properties(joinrel, outer_rel, inner_rel);
505505@@ -851,6 +852,7 @@ build_child_join_rel(PlannerInfo *root, RelOptInfo *outer_rel,
506506 joinrel->partexprs = NULL;
507507 joinrel->nullable_partexprs = NULL;
508508 joinrel->partitioned_child_rels = NIL;
509- + joinrel->private = NULL;
509+ + joinrel->ext_nodes = NULL;
510510
511511 joinrel->top_parent_relids = bms_union(outer_rel->top_parent_relids,
512512 inner_rel->top_parent_relids);
@@ -596,10 +596,10 @@ index ba661d32a6..09d0abe58b 100644
596596 extern void ExplainQuery(ParseState *pstate, ExplainStmt *stmt,
597597 ParamListInfo params, DestReceiver *dest);
598598diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h
599- index69150e46eb..c7361a7ef4 100644
599+ index5ebf070979..5b2acd7de2 100644
600600--- a/src/include/nodes/pathnodes.h
601601+++ b/src/include/nodes/pathnodes.h
602- @@ -738 ,6 +738 ,10 @@ typedef struct RelOptInfo
602+ @@ -739 ,6 +739 ,10 @@ typedef struct RelOptInfo
603603 Relidstop_parent_relids;/* Relids of topmost parents (if "other"
604604 * rel) */
605605
@@ -610,16 +610,20 @@ index 69150e46eb..c7361a7ef4 100644
610610 /* used for partitioned relations: */
611611 PartitionScheme part_scheme;/* Partitioning scheme */
612612 intnparts;/* Number of partitions; -1 if not yet set; in
613- @@ -753 ,6 +757,8 @@ typedef struct RelOptInfo
613+ @@ -754 ,6 +758,12 @@ typedef struct RelOptInfo
614614 List **partexprs;/* Non-nullable partition key expressions */
615615 List **nullable_partexprs; /* Nullable partition key expressions */
616616 List *partitioned_child_rels; /* List of RT indexes */
617617+
618- + List*private;
618+ + /*
619+ + * At this list an extension can add additional nodes to pass an info along
620+ + * the planning and executing stages.
621+ + */
622+ + List*ext_nodes;
619623 } RelOptInfo;
620624
621625 /*
622- @@ -1104 ,6 +1110 ,10 @@ typedef struct ParamPathInfo
626+ @@ -1105 ,6 +1115 ,10 @@ typedef struct ParamPathInfo
623627 Relidsppi_req_outer;/* rels supplying parameters used by path */
624628 doubleppi_rows;/* estimated number of result tuples */
625629 List *ppi_clauses;/* join clauses available from outer rels */
@@ -631,16 +635,19 @@ index 69150e46eb..c7361a7ef4 100644
631635
632636
633637diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h
634- index 90f02ce6fd..b093dc46ce 100644
638+ index 90f02ce6fd..f3e2138ee2 100644
635639--- a/src/include/nodes/plannodes.h
636640+++ b/src/include/nodes/plannodes.h
637- @@ -159,6 +159,9 @@ typedef struct Plan
641+ @@ -159,6 +159,12 @@ typedef struct Plan
638642 */
639643 Bitmapset *extParam;
640644 Bitmapset *allParam;
641645+
642- + /* Additional field for an extension purposes. */
643- + List*private;
646+ + /*
647+ + * Additional fields for an extension purposes.
648+ + * TODO: allow to serialize/deserialize this list.
649+ + */
650+ + List*ext_nodes;
644651 } Plan;
645652
646653 /* ----------------