Why does create_foreignscan_path() not set the rowcounts based on
ParamPathInfo when the path is a parameterized path?  Please find
attached a patch.

Thanks,

Best regards,
Etsuro Fujita
*** 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;
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to