]> granicus.if.org Git - postgresql/blobdiff - src/backend/optimizer/util/pathnode.c
Add a Gather executor node.
[postgresql] / src / backend / optimizer / util / pathnode.c
index 4336ca1b782fabadd1f96f38e95ab96a96079cbb..1895a6894a37081b6c8278314cb42af113b8fcf0 100644 (file)
@@ -1307,6 +1307,32 @@ create_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath,
        return pathnode;
 }
 
+/*
+ * create_gather_path
+ *
+ *       Creates a path corresponding to a gather scan, returning the
+ *       pathnode.
+ */
+GatherPath *
+create_gather_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath,
+                                  Relids required_outer, int nworkers)
+{
+       GatherPath *pathnode = makeNode(GatherPath);
+
+       pathnode->path.pathtype = T_Gather;
+       pathnode->path.parent = rel;
+       pathnode->path.param_info = get_baserel_parampathinfo(root, rel,
+                                                                                                                 required_outer);
+       pathnode->path.pathkeys = NIL;          /* Gather has unordered result */
+
+       pathnode->subpath = subpath;
+       pathnode->num_workers = nworkers;
+
+       cost_gather(pathnode, root, rel, pathnode->path.param_info);
+
+       return pathnode;
+}
+
 /*
  * translate_sub_tlist - get subquery column numbers represented by tlist
  *