*** a/src/backend/optimizer/util/pathnode.c --- b/src/backend/optimizer/util/pathnode.c *************** *** 1722,1733 **** create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel, List *fdw_private) { ForeignPath *pathnode = makeNode(ForeignPath); pathnode->path.pathtype = T_ForeignScan; pathnode->path.parent = rel; ! pathnode->path.param_info = get_baserel_parampathinfo(root, rel, ! required_outer); ! pathnode->path.rows = rows; pathnode->path.startup_cost = startup_cost; pathnode->path.total_cost = total_cost; pathnode->path.pathkeys = pathkeys; --- 1722,1740 ---- List *fdw_private) { ForeignPath *pathnode = makeNode(ForeignPath); + ParamPathInfo *param_info = get_baserel_parampathinfo(root, rel, + required_outer); pathnode->path.pathtype = T_ForeignScan; pathnode->path.parent = rel; ! pathnode->path.param_info = param_info; ! ! /* Mark the path with the correct row estimate */ ! if (param_info) ! pathnode->path.rows = param_info->ppi_rows; ! else ! pathnode->path.rows = rows; ! pathnode->path.startup_cost = startup_cost; pathnode->path.total_cost = total_cost; pathnode->path.pathkeys = pathkeys;