From 462bb7f12851c215dfc21a88ae0ed4bf7fcb36a3 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 2 Mar 2023 11:34:29 -0500 Subject: Remove bms_first_member(). This function has been semi-deprecated ever since we invented bms_next_member(). Its habit of scribbling on the input bitmapset isn't great, plus for sufficiently large bitmapsets it would take O(N^2) time to complete a loop. Now we have the additional problem that reducing the input to empty while leaving it still accessible would violate a planned invariant. So let's just get rid of it, after updating the few extant callers to use bms_next_member(). Patch by me; thanks to Nathan Bossart and Richard Guo for review. Discussion: https://postgr.es/m/1159933.1677621588@sss.pgh.pa.us --- src/backend/executor/nodeAgg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/backend/executor/nodeAgg.c') diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c index 20d23696a53..5960e4a6c19 100644 --- a/src/backend/executor/nodeAgg.c +++ b/src/backend/executor/nodeAgg.c @@ -1646,7 +1646,8 @@ find_hash_columns(AggState *aggstate) } /* and add the remaining columns */ - while ((i = bms_first_member(colnos)) >= 0) + i = -1; + while ((i = bms_next_member(colnos, i)) >= 0) { perhash->hashGrpColIdxInput[perhash->numhashGrpCols] = i; perhash->numhashGrpCols++; -- cgit v1.2.3