@@ -57,47 +57,47 @@ index bc05c96b4c..b6a3abe0d2 100644
57
57
if (es->format == EXPLAIN_FORMAT_TEXT)
58
58
appendStringInfoChar(es->str, '\n');
59
59
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
60
- index 682b28ed72..e64ea3ff46 100644
60
+ index 682b28ed72..3a5c615deb 100644
61
61
--- a/src/backend/nodes/copyfuncs.c
62
62
+++ b/src/backend/nodes/copyfuncs.c
63
63
@@ -132,6 +132,7 @@ CopyPlanFields(const Plan *from, Plan *newnode)
64
64
COPY_NODE_FIELD(initPlan);
65
65
COPY_BITMAPSET_FIELD(extParam);
66
66
COPY_BITMAPSET_FIELD(allParam);
67
- + COPY_NODE_FIELD(private );
67
+ + COPY_NODE_FIELD(ext_nodes );
68
68
}
69
69
70
70
/*
71
71
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
72
- index 7237b52e96..025b4fde2b 100644
72
+ index 7237b52e96..5e2ee2732a 100644
73
73
--- a/src/backend/nodes/outfuncs.c
74
74
+++ b/src/backend/nodes/outfuncs.c
75
75
@@ -342,6 +342,7 @@ _outPlanInfo(StringInfo str, const Plan *node)
76
76
WRITE_NODE_FIELD(initPlan);
77
77
WRITE_BITMAPSET_FIELD(extParam);
78
78
WRITE_BITMAPSET_FIELD(allParam);
79
- + /*WRITE_NODE_FIELD(private ); */
79
+ + /*WRITE_NODE_FIELD(ext_nodes ); */
80
80
}
81
81
82
82
/*
83
83
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c
84
- index 62c945b6c5..23ab51fb9b 100644
84
+ index 62c945b6c5..a39046ca56 100644
85
85
--- a/src/backend/nodes/readfuncs.c
86
86
+++ b/src/backend/nodes/readfuncs.c
87
87
@@ -1580,6 +1580,11 @@ ReadCommonPlan(Plan *local_node)
88
88
READ_NODE_FIELD(initPlan);
89
89
READ_BITMAPSET_FIELD(extParam);
90
90
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 );
93
93
+ * Don't serialize this field. It is required to serialize RestrictInfo and
94
94
+ * EqualenceClass.
95
95
+ */
96
96
}
97
97
98
98
/*
99
99
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
100
- index92b5223fee..a533c2cada 100644
100
+ index4edc859cb5..988f2e6ab7 100644
101
101
--- a/src/backend/optimizer/path/costsize.c
102
102
+++ b/src/backend/optimizer/path/costsize.c
103
103
@@ -98,6 +98,12 @@
@@ -121,7 +121,7 @@ index 92b5223fee..a533c2cada 100644
121
121
122
122
123
123
/*
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)
125
125
}
126
126
127
127
@@ -180,7 +180,7 @@ index 92b5223fee..a533c2cada 100644
180
180
/*
181
181
* set_baserel_size_estimates
182
182
*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)
184
184
void
185
185
set_baserel_size_estimates(PlannerInfo *root, RelOptInfo *rel)
186
186
{
@@ -201,7 +201,7 @@ index 92b5223fee..a533c2cada 100644
201
201
202
202
cost_qual_eval(&rel->baserestrictcost, rel->baserestrictinfo, root);
203
203
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)
205
205
* get_parameterized_baserel_size
206
206
*Make a size estimate for a parameterized scan of a base relation.
207
207
*
@@ -237,7 +237,7 @@ index 92b5223fee..a533c2cada 100644
237
237
{
238
238
List *allclauses;
239
239
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,
241
241
* set_joinrel_size_estimates
242
242
*Set the size estimates for the given join relation.
243
243
*
@@ -274,7 +274,7 @@ index 92b5223fee..a533c2cada 100644
274
274
* The rel's targetlist must have been constructed already, and a
275
275
* restriction clause list that matches the given component rels must
276
276
* 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,
278
278
* build_joinrel_tlist, and baserestrictcost is not used for join rels.
279
279
*/
280
280
void
@@ -291,7 +291,7 @@ index 92b5223fee..a533c2cada 100644
291
291
{
292
292
rel->rows = calc_joinrel_size_estimate(root,
293
293
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,
295
295
* get_parameterized_joinrel_size
296
296
*Make a size estimate for a parameterized scan of a join relation.
297
297
*
@@ -327,7 +327,7 @@ index 92b5223fee..a533c2cada 100644
327
327
* 'rel' is the joinrel under consideration.
328
328
* 'outer_path', 'inner_path' are (probably also parameterized) Paths that
329
329
*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,
331
331
* set_joinrel_size_estimates must have been applied already.
332
332
*/
333
333
double
@@ -344,7 +344,7 @@ index 92b5223fee..a533c2cada 100644
344
344
{
345
345
doublenrows;
346
346
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)
348
348
/* Should only be applied to base relations */
349
349
Assert(rel->relid > 0);
350
350
@@ -353,7 +353,7 @@ index 92b5223fee..a533c2cada 100644
353
353
354
354
cost_qual_eval(&rel->baserestrictcost, rel->baserestrictinfo, root);
355
355
356
- @@ -5710 ,7 +5837 ,7 @@ page_size(double tuples, int width)
356
+ @@ -5716 ,7 +5843 ,7 @@ page_size(double tuples, int width)
357
357
* Estimate the fraction of the work that each worker will do given the
358
358
* number of workers budgeted for the path.
359
359
*/
@@ -363,7 +363,7 @@ index 92b5223fee..a533c2cada 100644
363
363
{
364
364
doubleparallel_divisor = path->parallel_workers;
365
365
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c
366
- indexe445debe57..365b7aa319 100644
366
+ index917713c163..5b7bf1cec6 100644
367
367
--- a/src/backend/optimizer/plan/createplan.c
368
368
+++ b/src/backend/optimizer/plan/createplan.c
369
369
@@ -70,6 +70,7 @@
@@ -385,11 +385,11 @@ index e445debe57..365b7aa319 100644
385
385
return plan;
386
386
}
387
387
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)
389
389
dest->plan_width = src->pathtarget->width;
390
390
dest->parallel_aware = src->parallel_aware;
391
391
dest->parallel_safe = src->parallel_safe;
392
- + dest->private = NIL;
392
+ + dest->ext_nodes = NIL;
393
393
}
394
394
395
395
/*
@@ -475,14 +475,14 @@ index 60e7fda6a9..5732c7a685 100644
475
475
extra->targetList);
476
476
477
477
diff --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
479
479
--- a/src/backend/optimizer/util/relnode.c
480
480
+++ b/src/backend/optimizer/util/relnode.c
481
481
@@ -258,6 +258,7 @@ build_simple_rel(PlannerInfo *root, int relid, RelOptInfo *parent)
482
482
rel->partexprs = NULL;
483
483
rel->nullable_partexprs = NULL;
484
484
rel->partitioned_child_rels = NIL;
485
- + rel->private = NULL;
485
+ + rel->ext_nodes = NULL;
486
486
487
487
/*
488
488
* Pass assorted information down the inheritance hierarchy.
@@ -498,15 +498,15 @@ index a203e6f1ff..f8db135be0 100644
498
498
joinrel->partexprs = NULL;
499
499
joinrel->nullable_partexprs = NULL;
500
500
joinrel->partitioned_child_rels = NIL;
501
- + joinrel->private = NULL;
501
+ + joinrel->ext_nodes = NULL;
502
502
503
503
/* Compute information relevant to the foreign relations. */
504
504
set_foreign_rel_properties(joinrel, outer_rel, inner_rel);
505
505
@@ -851,6 +852,7 @@ build_child_join_rel(PlannerInfo *root, RelOptInfo *outer_rel,
506
506
joinrel->partexprs = NULL;
507
507
joinrel->nullable_partexprs = NULL;
508
508
joinrel->partitioned_child_rels = NIL;
509
- + joinrel->private = NULL;
509
+ + joinrel->ext_nodes = NULL;
510
510
511
511
joinrel->top_parent_relids = bms_union(outer_rel->top_parent_relids,
512
512
inner_rel->top_parent_relids);
@@ -596,10 +596,10 @@ index ba661d32a6..09d0abe58b 100644
596
596
extern void ExplainQuery(ParseState *pstate, ExplainStmt *stmt,
597
597
ParamListInfo params, DestReceiver *dest);
598
598
diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h
599
- index69150e46eb..c7361a7ef4 100644
599
+ index5ebf070979..5b2acd7de2 100644
600
600
--- a/src/include/nodes/pathnodes.h
601
601
+++ b/src/include/nodes/pathnodes.h
602
- @@ -738 ,6 +738 ,10 @@ typedef struct RelOptInfo
602
+ @@ -739 ,6 +739 ,10 @@ typedef struct RelOptInfo
603
603
Relidstop_parent_relids;/* Relids of topmost parents (if "other"
604
604
* rel) */
605
605
@@ -610,16 +610,20 @@ index 69150e46eb..c7361a7ef4 100644
610
610
/* used for partitioned relations: */
611
611
PartitionScheme part_scheme;/* Partitioning scheme */
612
612
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
614
614
List **partexprs;/* Non-nullable partition key expressions */
615
615
List **nullable_partexprs; /* Nullable partition key expressions */
616
616
List *partitioned_child_rels; /* List of RT indexes */
617
617
+
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;
619
623
} RelOptInfo;
620
624
621
625
/*
622
- @@ -1104 ,6 +1110 ,10 @@ typedef struct ParamPathInfo
626
+ @@ -1105 ,6 +1115 ,10 @@ typedef struct ParamPathInfo
623
627
Relidsppi_req_outer;/* rels supplying parameters used by path */
624
628
doubleppi_rows;/* estimated number of result tuples */
625
629
List *ppi_clauses;/* join clauses available from outer rels */
@@ -631,16 +635,19 @@ index 69150e46eb..c7361a7ef4 100644
631
635
632
636
633
637
diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h
634
- index 90f02ce6fd..b093dc46ce 100644
638
+ index 90f02ce6fd..f3e2138ee2 100644
635
639
--- a/src/include/nodes/plannodes.h
636
640
+++ b/src/include/nodes/plannodes.h
637
- @@ -159,6 +159,9 @@ typedef struct Plan
641
+ @@ -159,6 +159,12 @@ typedef struct Plan
638
642
*/
639
643
Bitmapset *extParam;
640
644
Bitmapset *allParam;
641
645
+
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;
644
651
} Plan;
645
652
646
653
/* ----------------