Re: Unexpected (wrong?) result querying boolean partitioned table with NULL partition - Mailing list pgsql-hackers

From David Rowley
Subject Re: Unexpected (wrong?) result querying boolean partitioned table with NULL partition
Date
Msg-id CAApHDvr00ZjvA5WQ__OUR-cquyLhYAaxHpEbype2b-=ffrCqmw@mail.gmail.com
Whole thread Raw
In response to Re: Unexpected (wrong?) result querying boolean partitioned table with NULL partition  (Richard Guo <guofenglinux@gmail.com>)
Responses Re: Unexpected (wrong?) result querying boolean partitioned table with NULL partition
List pgsql-hackers
On Thu, 13 Apr 2023 at 15:30, Richard Guo <guofenglinux@gmail.com> wrote:
> 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;

I wondered about that, hence my not-so-commitable comment left in there.

My last thoughts were that maybe we should just move the IS_UNKNOWN
and IS_NOT_UNKNOWN down into the switch and let -Wall let us know if
something is missing.

It hardly seems worth keeping the slightly earlier exit for those two
cases. That just amounts to the RelabelType check and is this the
partition key.  I doubt IS[_NOT]_UNKNOWN is common enough for us to
warrant contorting the code to make it a few dozen nanoseconds faster.
Having smaller code is probably more of a win, which we'd get if we
didn't add the ERROR you propose.

> Otherwise the patch looks good to me.

Thanks for having a look.

David



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Should we remove vacuum_defer_cleanup_age?
Next
From: Michael Paquier
Date:
Subject: Re: Clean up hba.c of code freeing regexps