v1-0001-Trivial-revise-for-the-check-of-parameterized-partial-paths.patch

application/octet-stream

Filename: v1-0001-Trivial-revise-for-the-check-of-parameterized-partial-paths.patch
Type: application/octet-stream
Part: 0
Message: Trivial revise for the check of parameterized partial paths

Patch

Format: format-patch
Series: patch v1-0001
Subject: Trivial revise for the check of parameterized partial paths
File+
src/backend/optimizer/path/joinpath.c 9 18
From 6a36b7925f6324cdf3a4e84b2af02b7c522dfca3 Mon Sep 17 00:00:00 2001
From: Richard Guo <guofenglinux@gmail.com>
Date: Thu, 29 Jun 2023 10:52:59 +0800
Subject: [PATCH v1] Trivial revise for the check of parameterized partial
 paths

---
 src/backend/optimizer/path/joinpath.c | 27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/src/backend/optimizer/path/joinpath.c b/src/backend/optimizer/path/joinpath.c
index c2f211a60d..e4200049b8 100644
--- a/src/backend/optimizer/path/joinpath.c
+++ b/src/backend/optimizer/path/joinpath.c
@@ -813,6 +813,7 @@ try_partial_nestloop_path(PlannerInfo *root,
 	 * rels are required here.
 	 */
 	Assert(bms_is_empty(joinrel->lateral_relids));
+	Assert(bms_is_empty(PATH_REQ_OUTER(outer_path)));
 	if (inner_path->param_info != NULL)
 	{
 		Relids		inner_paramrels = inner_path->param_info->ppi_req_outer;
@@ -990,13 +991,9 @@ try_partial_mergejoin_path(PlannerInfo *root,
 	 * See comments in try_partial_hashjoin_path().
 	 */
 	Assert(bms_is_empty(joinrel->lateral_relids));
-	if (inner_path->param_info != NULL)
-	{
-		Relids		inner_paramrels = inner_path->param_info->ppi_req_outer;
-
-		if (!bms_is_empty(inner_paramrels))
-			return;
-	}
+	Assert(bms_is_empty(PATH_REQ_OUTER(outer_path)));
+	if (!bms_is_empty(PATH_REQ_OUTER(inner_path)))
+		return;
 
 	/*
 	 * If the given paths are already well enough ordered, we can skip doing
@@ -1121,19 +1118,13 @@ try_partial_hashjoin_path(PlannerInfo *root,
 	JoinCostWorkspace workspace;
 
 	/*
-	 * If the inner path is parameterized, the parameterization must be fully
-	 * satisfied by the proposed outer path.  Parameterized partial paths are
-	 * not supported.  The caller should already have verified that no lateral
-	 * rels are required here.
+	 * Parameterized partial paths are not supported.  The caller should
+	 * already have verified that no lateral rels are required here.
 	 */
 	Assert(bms_is_empty(joinrel->lateral_relids));
-	if (inner_path->param_info != NULL)
-	{
-		Relids		inner_paramrels = inner_path->param_info->ppi_req_outer;
-
-		if (!bms_is_empty(inner_paramrels))
-			return;
-	}
+	Assert(bms_is_empty(PATH_REQ_OUTER(outer_path)));
+	if (!bms_is_empty(PATH_REQ_OUTER(inner_path)))
+		return;
 
 	/*
 	 * Before creating a path, get a quick lower bound on what it is likely to
-- 
2.31.0