v13-0006-Fix-a-bug-with-get_ecmember_indexes_strict-incor.patch

application/octet-stream

Filename: v13-0006-Fix-a-bug-with-get_ecmember_indexes_strict-incor.patch
Type: application/octet-stream
Part: 5
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 v13-0006
Subject: Fix a bug with get_ecmember_indexes_strict() incorrectly handling empty relids
File+
src/backend/optimizer/path/equivclass.c 11 0
From b90f94a7d53670fa8334a8b12b05c163e56a3b1e Mon Sep 17 00:00:00 2001
From: Yuya Watari <watari.yuya@gmail.com>
Date: Mon, 30 Jan 2023 14:48:07 +0900
Subject: [PATCH v13 6/7] Fix a bug with get_ecmember_indexes_strict()
 incorrectly handling empty relids

---
 src/backend/optimizer/path/equivclass.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/backend/optimizer/path/equivclass.c b/src/backend/optimizer/path/equivclass.c
index 83ea0313e1..6e53f1887a 100644
--- a/src/backend/optimizer/path/equivclass.c
+++ b/src/backend/optimizer/path/equivclass.c
@@ -3519,6 +3519,17 @@ get_ecmember_indexes_strict(PlannerInfo *root, EquivalenceClass *ec,
 										   rel->eclass_member_indexes);
 		}
 	}
+	else
+	{
+		/*
+		 * If 'relids' is empty, the relids of any EquivalenceMember can be a
+		 * superset of 'relids'.
+		 */
+		if (!with_children)
+			matching_ems = bms_copy(ec->ec_nonchild_indexes);
+		else
+			matching_ems = bms_copy(ec->ec_member_indexes);
+	}
 
 #ifdef USE_ASSERT_CHECKING
 	/* verify the results look sane */
-- 
2.35.3.windows.1