Skip to content

Commit 6eb2f0e

Browse files
committed
Add missing MaterialPath support in reparameterize_path[_by_child].
These two functions failed to cover MaterialPath. That's not a fatal problem, but we can generate better plans in some cases if we support it. Tom Lane and Richard Guo Discussion: https://postgr.es/m/[email protected]
1 parent fe12f2f commit 6eb2f0e

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

src/backend/optimizer/util/pathnode.c

+24-1
Original file line numberDiff line numberDiff line change
@@ -3979,6 +3979,18 @@ reparameterize_path(PlannerInfo *root, Path *path,
39793979
apath->path.parallel_aware,
39803980
-1);
39813981
}
3982+
case T_Material:
3983+
{
3984+
MaterialPath *mpath = (MaterialPath *) path;
3985+
Path *spath = mpath->subpath;
3986+
3987+
spath = reparameterize_path(root, spath,
3988+
required_outer,
3989+
loop_count);
3990+
if (spath == NULL)
3991+
return NULL;
3992+
return (Path *) create_material_path(rel, spath);
3993+
}
39823994
case T_Memoize:
39833995
{
39843996
MemoizePath *mpath = (MemoizePath *) path;
@@ -4013,7 +4025,8 @@ reparameterize_path(PlannerInfo *root, Path *path,
40134025
* path->parent, which does not change during the translation. Hence those
40144026
* members are copied as they are.
40154027
*
4016-
* If the given path can not be reparameterized, the function returns NULL.
4028+
* Currently, only a few path types are supported here, though more could be
4029+
* added at need. We return NULL if we can't reparameterize the given path.
40174030
*/
40184031
Path *
40194032
reparameterize_path_by_child(PlannerInfo *root, Path *path,
@@ -4211,6 +4224,16 @@ do { \
42114224
}
42124225
break;
42134226

4227+
case T_MaterialPath:
4228+
{
4229+
MaterialPath *mpath;
4230+
4231+
FLAT_COPY_PATH(mpath, path, MaterialPath);
4232+
REPARAMETERIZE_CHILD_PATH(mpath->subpath);
4233+
new_path = (Path *) mpath;
4234+
}
4235+
break;
4236+
42144237
case T_MemoizePath:
42154238
{
42164239
MemoizePath *mpath;

0 commit comments

Comments
 (0)