v18-0003-Fix-an-assertion.patch

application/octet-stream

Filename: v18-0003-Fix-an-assertion.patch
Type: application/octet-stream
Part: 2
Message: Re: [PoC] Reducing planning time when tables have many partitions

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: format-patch
Series: patch v18-0003
Subject: Fix an assertion
File+
src/backend/optimizer/path/equivclass.c 1 1
From a47bf2f223fe1eac2416215c48f7e9e10257b821 Mon Sep 17 00:00:00 2001
From: Yuya Watari <watari.yuya@gmail.com>
Date: Mon, 6 Feb 2023 09:25:35 +0900
Subject: [PATCH v18 3/5] Fix an assertion

Fix an assertion to deal with root->simple_rel_array[0].

This fix is required because the while condition for looping through
relids has been changed in our patches as follows:

- while ((i = bms_next_member(newec->ec_relids, i)) > 0)
+ while ((i = bms_next_member(newec->ec_relids, i)) >= 0)

Originally, we stopped iterating when we we reached the
root->simple_rel_array[0] member. However, we do not do so with our
patches, so the assertion of Assert(bms_is_member(i,
root->outer_join_rels)) may fail. To solve this problem, this commit
changes its condition.

TODO: Do we need to change the other occurances?
---
 src/backend/optimizer/path/equivclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/optimizer/path/equivclass.c b/src/backend/optimizer/path/equivclass.c
index 9205e4093f..101b881b51 100644
--- a/src/backend/optimizer/path/equivclass.c
+++ b/src/backend/optimizer/path/equivclass.c
@@ -838,7 +838,7 @@ get_eclass_for_sort_expr(PlannerInfo *root,
 
 			if (rel == NULL)	/* must be an outer join */
 			{
-				Assert(bms_is_member(i, root->outer_join_rels));
+				Assert(i == 0 || bms_is_member(i, root->outer_join_rels));
 				continue;
 			}
 
-- 
2.39.2.windows.1