Re: Multi-Column List Partitioning

From: Amul Sul <sulamul(at)gmail(dot)com>
To: Amit Langote <amitlangote09(at)gmail(dot)com>
Cc: Nitin Jadhav <nitinjadhavpostgres(at)gmail(dot)com>, Rajkumar Raghuwanshi <rajkumar(dot)raghuwanshi(at)enterprisedb(dot)com>, Zhihong Yu <zyu(at)yugabyte(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Multi-Column List Partitioning
Date: 2021-12-09 06:11:19
Message-ID: CAAJ_b94=MksCCNagNOauh45z7r=+GZUvMMWh7v3G3+RS1_D1+w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Dec 9, 2021 at 11:24 AM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
>
[....]
> On Mon, Dec 6, 2021 at 10:57 PM Nitin Jadhav
> <nitinjadhavpostgres(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2021-12-09 06:12:30 Re: add recovery, backup, archive, streaming etc. activity messages to server logs along with ps display
Previous Message Bharath Rupireddy 2021-12-09 05:58:41 Re: add recovery, backup, archive, streaming etc. activity messages to server logs along with ps display