From 68aba7d769333d4ef70f4da71c72497ff9402fc8 Mon Sep 17 00:00:00 2001 From: Yuya Watari Date: Mon, 6 Feb 2023 09:25:35 +0900 Subject: [PATCH v19 2/4] 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 91855b4bb0..530f1e9984 100644 --- a/src/backend/optimizer/path/equivclass.c +++ b/src/backend/optimizer/path/equivclass.c @@ -841,7 +841,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.41.0.windows.1