Re: Missing MaterialPath support in reparameterize_path_by_child - Mailing list pgsql-hackers

From Richard Guo
Subject Re: Missing MaterialPath support in reparameterize_path_by_child
Date
Msg-id CAMbWs4_x6ZBFF1aNvLn=HNGo6SJ3ryTDvKdjeZtEdquc7J5jSQ@mail.gmail.com
Whole thread Raw
In response to Re: Missing MaterialPath support in reparameterize_path_by_child  (Richard Guo <guofenglinux@gmail.com>)
List pgsql-hackers

On Fri, Dec 2, 2022 at 8:49 PM Richard Guo <guofenglinux@gmail.com> wrote:
BTW, the code changes I'm using:

--- a/src/backend/optimizer/util/pathnode.c
+++ b/src/backend/optimizer/util/pathnode.c
@@ -3979,6 +3979,17 @@ reparameterize_path(PlannerInfo *root, Path *path,
                                       apath->path.parallel_aware,
                                       -1);
            }
+       case T_Material:
+           {
+               MaterialPath *matpath = (MaterialPath *) path;
+               Path         *spath = matpath->subpath;
+
+               spath = reparameterize_path(root, spath,
+                                           required_outer,
+                                           loop_count);
+
+               return (Path *) create_material_path(rel, spath);
+           }
 
BTW, the subpath needs to be checked if it is null after being
reparameterized, since it might be a path type that is not supported
yet.

--- a/src/backend/optimizer/util/pathnode.c
+++ b/src/backend/optimizer/util/pathnode.c
@@ -3979,6 +3979,19 @@ reparameterize_path(PlannerInfo *root, Path *path,
                                       apath->path.parallel_aware,
                                       -1);
            }
+       case T_Material:
+           {
+               MaterialPath *matpath = (MaterialPath *) path;
+               Path         *spath = matpath->subpath;
+
+               spath = reparameterize_path(root, spath,
+                                           required_outer,
+                                           loop_count);
+               if (spath == NULL)
+                   return NULL;
+
+               return (Path *) create_material_path(rel, spath);
+           }

Thanks
Richard

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Removing another gen_node_support.pl special case
Next
From: Robert Haas
Date:
Subject: Re: Error-safe user functions