From 06d24333eabc3c9c5ef4df8ef100dbaaacd3dc16 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 7 Jun 2021 15:55:40 +0200 Subject: [PATCH v1 04/10] Change SeqScan node to contain Scan node This makes the structure of all Scan-derived nodes the same, independent of whether they have additional fields. --- src/backend/executor/nodeSeqscan.c | 4 ++-- src/backend/nodes/readfuncs.c | 2 +- src/backend/optimizer/plan/createplan.c | 6 +++--- src/backend/optimizer/plan/setrefs.c | 10 +++++----- src/include/nodes/plannodes.h | 5 ++++- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/backend/executor/nodeSeqscan.c b/src/backend/executor/nodeSeqscan.c index 066f9ae37e..4d2bf16a6f 100644 --- a/src/backend/executor/nodeSeqscan.c +++ b/src/backend/executor/nodeSeqscan.c @@ -151,7 +151,7 @@ ExecInitSeqScan(SeqScan *node, EState *estate, int eflags) */ scanstate->ss.ss_currentRelation = ExecOpenScanRelation(estate, - node->scanrelid, + node->scan.scanrelid, eflags); /* and create slot with the appropriate rowtype */ @@ -169,7 +169,7 @@ ExecInitSeqScan(SeqScan *node, EState *estate, int eflags) * initialize child expressions */ scanstate->ss.ps.qual = - ExecInitQual(node->plan.qual, (PlanState *) scanstate); + ExecInitQual(node->scan.plan.qual, (PlanState *) scanstate); return scanstate; } diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c index f0b34ecfac..fef4de94e6 100644 --- a/src/backend/nodes/readfuncs.c +++ b/src/backend/nodes/readfuncs.c @@ -1832,7 +1832,7 @@ _readSeqScan(void) { READ_LOCALS_NO_FIELDS(SeqScan); - ReadCommonScan(local_node); + ReadCommonScan(&local_node->scan); READ_DONE(); } diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c index 439e6b6426..769b5a0cf7 100644 --- a/src/backend/optimizer/plan/createplan.c +++ b/src/backend/optimizer/plan/createplan.c @@ -2858,7 +2858,7 @@ create_seqscan_plan(PlannerInfo *root, Path *best_path, scan_clauses, scan_relid); - copy_generic_path_info(&scan_plan->plan, best_path); + copy_generic_path_info(&scan_plan->scan.plan, best_path); return scan_plan; } @@ -5372,13 +5372,13 @@ make_seqscan(List *qptlist, Index scanrelid) { SeqScan *node = makeNode(SeqScan); - Plan *plan = &node->plan; + Plan *plan = &node->scan.plan; plan->targetlist = qptlist; plan->qual = qpqual; plan->lefttree = NULL; plan->righttree = NULL; - node->scanrelid = scanrelid; + node->scan.scanrelid = scanrelid; return node; } diff --git a/src/backend/optimizer/plan/setrefs.c b/src/backend/optimizer/plan/setrefs.c index 61ccfd300b..6cb2d731c8 100644 --- a/src/backend/optimizer/plan/setrefs.c +++ b/src/backend/optimizer/plan/setrefs.c @@ -516,12 +516,12 @@ set_plan_refs(PlannerInfo *root, Plan *plan, int rtoffset) { SeqScan *splan = (SeqScan *) plan; - splan->scanrelid += rtoffset; - splan->plan.targetlist = - fix_scan_list(root, splan->plan.targetlist, + splan->scan.scanrelid += rtoffset; + splan->scan.plan.targetlist = + fix_scan_list(root, splan->scan.plan.targetlist, rtoffset, NUM_EXEC_TLIST(plan)); - splan->plan.qual = - fix_scan_list(root, splan->plan.qual, + splan->scan.plan.qual = + fix_scan_list(root, splan->scan.plan.qual, rtoffset, NUM_EXEC_QUAL(plan)); } break; diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h index aaa3b65d04..35ff94fbb6 100644 --- a/src/include/nodes/plannodes.h +++ b/src/include/nodes/plannodes.h @@ -348,7 +348,10 @@ typedef struct Scan * sequential scan node * ---------------- */ -typedef Scan SeqScan; +typedef struct SeqScan +{ + Scan scan; +} SeqScan; /* ---------------- * table sample scan node -- 2.31.1