On Fri, Dec 2, 2022 at 8:49 PM Richard Guo <[email protected]> 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