Re: Missing MaterialPath support in reparameterize_path_by_child

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Missing MaterialPath support in reparameterize_path_by_child
Date: 2022-12-02 13:16:07
Message-ID: CAMbWs4_x6ZBFF1aNvLn=HNGo6SJ3ryTDvKdjeZtEdquc7J5jSQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 2, 2022 at 8:49 PM Richard Guo <guofenglinux(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2022-12-02 13:27:58 Re: Error-safe user functions
Previous Message Peter Eisentraut 2022-12-02 13:00:55 Re: Removing another gen_node_support.pl special case