On Thu, Dec 9, 2021 at 11:24 AM Amit Langote <amitlangot...@gmail.com> wrote: > [....] > On Mon, Dec 6, 2021 at 10:57 PM Nitin Jadhav > <nitinjadhavpostg...@gmail.com> wrote: > > > Looks difficult to understand at first glance, how about the following: > > > > > > if (b1->isnulls != b2->isnulls) > > > return false; > > I don't think having this block is correct, because this says that two > PartitionBoundInfos can't be "logically" equal unless their isnulls > pointers are the same, which is not the case unless they are > physically the same PartitionBoundInfo. What this means for its only > caller compute_partition_bounds() is that it now always needs to > perform partition_bounds_merge() for a pair of list-partitioned > relations, even if they have exactly the same bounds. > > So, I'd suggest removing the block. >
Agreed, I too realized the same; the check is incorrect and have noted it for the next post. But note that, we need a kind of check here otherwise, how could two bounds be equal if one has nulls and the other doesn't. Also, we would have a segmentation fault in the next block while accessing b2->isnulls if that is null. I would suggest check like this: if ((b1->isnulls == NULL) != (b2->isnulls == NULL)) return false; OR if ((b1->isnulls) ^ (b2->isnulls)) return false; Regards, Amul