Re: Unexpected (wrong?) result querying boolean partitioned table with NULL partition

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: David Kimura <david(dot)g(dot)kimura(at)gmail(dot)com>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Unexpected (wrong?) result querying boolean partitioned table with NULL partition
Date: 2023-04-13 03:30:05
Message-ID: CAMbWs49OLBVCwuq7ucCio1x-x7DaaF+c5NkT=ZDOpwodFXPRkg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Apr 13, 2023 at 10:39 AM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:

> On Wed, Apr 12, 2023 at 7:13 PM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
>
>> There's already code to effectively handle <> operators. Just the
>> PartClauseInfo.op_is_ne needs to be set to true.
>> get_matching_list_bounds() then handles that by taking the inverse of
>> the partitions matching the equality operator.
>>
>> Effectively, I think that's the attached patch.
>
>
> I think there is a thinko here.
>

Sorry. It's my thinko. In cases IS_NOT_TRUE and IS_NOT_FALSE the
op_is_ne is set to true. So the logic in origin patch is right.

BTW, I wonder if we should elog an Error here.

default:
- Assert(false); /* hmm? */
- return PARTCLAUSE_UNSUPPORTED;
+ elog(ERROR, "unrecognized booltesttype: %d",
+ (int) btest->booltesttype);
+ break;

Otherwise the patch looks good to me.

Thanks
Richard

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2023-04-13 03:34:24 Re: Should we remove vacuum_defer_cleanup_age?
Previous Message Julien Rouhaud 2023-04-13 02:51:10 Re: pg_upgrade and logical replication