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.

Discussion: https://www.postgresql.org/message-id/flat/c1097590-a6a4-486a-64b1-e1f9cc0533ce@enterprisedb.com
This commit is contained in:
Peter Eisentraut 2021-08-08 16:55:51 +02:00
parent 00116dee5a
commit 2226b4189b
5 changed files with 15 additions and 12 deletions

View File

@ -151,7 +151,7 @@ ExecInitSeqScan(SeqScan *node, EState *estate, int eflags)
*/ */
scanstate->ss.ss_currentRelation = scanstate->ss.ss_currentRelation =
ExecOpenScanRelation(estate, ExecOpenScanRelation(estate,
node->scanrelid, node->scan.scanrelid,
eflags); eflags);
/* and create slot with the appropriate rowtype */ /* and create slot with the appropriate rowtype */
@ -169,7 +169,7 @@ ExecInitSeqScan(SeqScan *node, EState *estate, int eflags)
* initialize child expressions * initialize child expressions
*/ */
scanstate->ss.ps.qual = scanstate->ss.ps.qual =
ExecInitQual(node->plan.qual, (PlanState *) scanstate); ExecInitQual(node->scan.plan.qual, (PlanState *) scanstate);
return scanstate; return scanstate;
} }

View File

@ -1833,7 +1833,7 @@ _readSeqScan(void)
{ {
READ_LOCALS_NO_FIELDS(SeqScan); READ_LOCALS_NO_FIELDS(SeqScan);
ReadCommonScan(local_node); ReadCommonScan(&local_node->scan);
READ_DONE(); READ_DONE();
} }

View File

@ -2855,7 +2855,7 @@ create_seqscan_plan(PlannerInfo *root, Path *best_path,
scan_clauses, scan_clauses,
scan_relid); scan_relid);
copy_generic_path_info(&scan_plan->plan, best_path); copy_generic_path_info(&scan_plan->scan.plan, best_path);
return scan_plan; return scan_plan;
} }
@ -5369,13 +5369,13 @@ make_seqscan(List *qptlist,
Index scanrelid) Index scanrelid)
{ {
SeqScan *node = makeNode(SeqScan); SeqScan *node = makeNode(SeqScan);
Plan *plan = &node->plan; Plan *plan = &node->scan.plan;
plan->targetlist = qptlist; plan->targetlist = qptlist;
plan->qual = qpqual; plan->qual = qpqual;
plan->lefttree = NULL; plan->lefttree = NULL;
plan->righttree = NULL; plan->righttree = NULL;
node->scanrelid = scanrelid; node->scan.scanrelid = scanrelid;
return node; return node;
} }

View File

@ -516,12 +516,12 @@ set_plan_refs(PlannerInfo *root, Plan *plan, int rtoffset)
{ {
SeqScan *splan = (SeqScan *) plan; SeqScan *splan = (SeqScan *) plan;
splan->scanrelid += rtoffset; splan->scan.scanrelid += rtoffset;
splan->plan.targetlist = splan->scan.plan.targetlist =
fix_scan_list(root, splan->plan.targetlist, fix_scan_list(root, splan->scan.plan.targetlist,
rtoffset, NUM_EXEC_TLIST(plan)); rtoffset, NUM_EXEC_TLIST(plan));
splan->plan.qual = splan->scan.plan.qual =
fix_scan_list(root, splan->plan.qual, fix_scan_list(root, splan->scan.plan.qual,
rtoffset, NUM_EXEC_QUAL(plan)); rtoffset, NUM_EXEC_QUAL(plan));
} }
break; break;

View File

@ -348,7 +348,10 @@ typedef struct Scan
* sequential scan node * sequential scan node
* ---------------- * ----------------
*/ */
typedef Scan SeqScan; typedef struct SeqScan
{
Scan scan;
} SeqScan;
/* ---------------- /* ----------------
* table sample scan node * table sample scan node