Content-Length: 282094 | pFad | http://github.com/postgrespro/postgres/commit/f29199d3190ffdc48f40233f58a346bbb906c060

5C Small cleanup of create_list_bounds() · postgrespro/postgres@f29199d · GitHub
Skip to content

Commit f29199d

Browse files
committed
Small cleanup of create_list_bounds()
When checking for interleaved partitions, we mark the partition as interleaved when; 1. we find an earlier partition index when looping over the sorted-by-Datum indexes[] array, or; 2. we find that the NULL partition allows some non-NULL Datum value. In the code, as it was written in db632fb we'll continue to check for case 2 when we've already marked the partition as interleaved for case 1. Here we make it so we don't bother marking the partition as interleaved for case 2 when it's already been marked due to case 1. Really all this saves is a useless call to bms_add_member(), but since this code is new to PG15, it seems worth fixing it now to save anyone the trouble of complaining at some time in the future. We have the opportunity to improve this now before PG15 is out. This might ease some future back-patching pain. Per report and patch by Zhihong Yu. However, I slightly revised the comments and altered the bms_add_member() code to match in both locations. We already know that index is equal to boundinfo->null_index from the if condition. Author: Zhihong Yu Discussion: https://postgr.es/m/CALNJ-vQbZR0pYxz9zQ5bqXVcwtGgNgVupeEpNT65HZ+yWZnc4g@mail.gmail.com Backpatch-through: 15, same as db632fb.
1 parent 08951a7 commit f29199d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/backend/partitioning/partbounds.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -648,13 +648,14 @@ create_list_bounds(PartitionBoundSpec **boundspecs, int nparts,
648648
index);
649649

650650
/*
651-
* Mark the NULL partition as interleaved if we find that it
652-
* allows some other non-NULL Datum.
651+
* Otherwise, if the null_index exists in the indexes array,
652+
* then the NULL partition must also allow some other Datum,
653+
* therefore it's "interleaved".
653654
*/
654-
if (partition_bound_accepts_nulls(boundinfo) &&
655-
index == boundinfo->null_index)
655+
else if (partition_bound_accepts_nulls(boundinfo) &&
656+
index == boundinfo->null_index)
656657
boundinfo->interleaved_parts = bms_add_member(boundinfo->interleaved_parts,
657-
boundinfo->null_index);
658+
index);
658659

659660
last_index = index;
660661
}

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/f29199d3190ffdc48f40233f58a346bbb906c060

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy