Assign correct locus to foreign join and upper paths
We forgot to assign while PostgreSQL 12 merge, some queries would error
out "ERROR: path of type 46 is missing distribution locus" without this
commit.
@@ -3361,6 +3361,21 @@ create_foreign_join_path(PlannerInfo *root, RelOptInfo *rel,
pathnode->path.total_cost = total_cost;
pathnode->path.pathkeys = pathkeys;
+ switch (rel->exec_location)
+ {
+ case FTEXECLOCATION_ANY:
+ CdbPathLocus_MakeGeneral(&(pathnode->path.locus));
+ break;
+ case FTEXECLOCATION_ALL_SEGMENTS:
+ CdbPathLocus_MakeStrewn(&(pathnode->path.locus), getgpsegmentCount());
+ break;
+ case FTEXECLOCATION_COORDINATOR:
+ CdbPathLocus_MakeEntry(&(pathnode->path.locus));
+ break;
+ default:
+ elog(ERROR, "unrecognized exec_location '%c'", rel->exec_location);
+ }
+
pathnode->fdw_outerpath = fdw_outerpath;
pathnode->fdw_private = fdw_private;
@@ -3406,6 +3421,21 @@ create_foreign_upper_path(PlannerInfo *root, RelOptInfo *rel,
pathnode->path.total_cost = total_cost;
pathnode->path.pathkeys = pathkeys;
+ switch (rel->exec_location)
+ {
+ case FTEXECLOCATION_ANY:
+ CdbPathLocus_MakeGeneral(&(pathnode->path.locus));
+ break;
+ case FTEXECLOCATION_ALL_SEGMENTS:
+ CdbPathLocus_MakeStrewn(&(pathnode->path.locus), getgpsegmentCount());
+ break;
+ case FTEXECLOCATION_COORDINATOR:
+ CdbPathLocus_MakeEntry(&(pathnode->path.locus));
+ break;
+ default:
+ elog(ERROR, "unrecognized exec_location '%c'", rel->exec_location);
+ }
+
pathnode->fdw_outerpath = fdw_outerpath;
pathnode->fdw_private = fdw_private;
