aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/util/pathnode.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2022-12-04 13:35:42 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2022-12-04 13:35:42 -0500
commit6eb2f0ed4cd5c8668c3127024a8a58b10fa2e8dc (patch)
tree532d4e850ec8f3ad8f76154cc9eec65095db81ed /src/backend/optimizer/util/pathnode.c
parentfe12f2f8fa608156c2d3c027cdd6aa9af0788e3a (diff)
downloadpostgresql-6eb2f0ed4cd5c8668c3127024a8a58b10fa2e8dc.tar.gz
postgresql-6eb2f0ed4cd5c8668c3127024a8a58b10fa2e8dc.zip
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/1854233.1669949723@sss.pgh.pa.us
Diffstat (limited to 'src/backend/optimizer/util/pathnode.c')
-rw-r--r--src/backend/optimizer/util/pathnode.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c
index 6dd11329fb5..ea2e158f6d4 100644
--- a/src/backend/optimizer/util/pathnode.c
+++ b/src/backend/optimizer/util/pathnode.c
@@ -3979,6 +3979,18 @@ reparameterize_path(PlannerInfo *root, Path *path,
apath->path.parallel_aware,
-1);
}
+ case T_Material:
+ {
+ MaterialPath *mpath = (MaterialPath *) path;
+ Path *spath = mpath->subpath;
+
+ spath = reparameterize_path(root, spath,
+ required_outer,
+ loop_count);
+ if (spath == NULL)
+ return NULL;
+ return (Path *) create_material_path(rel, spath);
+ }
case T_Memoize:
{
MemoizePath *mpath = (MemoizePath *) path;
@@ -4013,7 +4025,8 @@ reparameterize_path(PlannerInfo *root, Path *path,
* path->parent, which does not change during the translation. Hence those
* members are copied as they are.
*
- * If the given path can not be reparameterized, the function returns NULL.
+ * Currently, only a few path types are supported here, though more could be
+ * added at need. We return NULL if we can't reparameterize the given path.
*/
Path *
reparameterize_path_by_child(PlannerInfo *root, Path *path,
@@ -4211,6 +4224,16 @@ do { \
}
break;
+ case T_MaterialPath:
+ {
+ MaterialPath *mpath;
+
+ FLAT_COPY_PATH(mpath, path, MaterialPath);
+ REPARAMETERIZE_CHILD_PATH(mpath->subpath);
+ new_path = (Path *) mpath;
+ }
+ break;
+
case T_MemoizePath:
{
MemoizePath *mpath;