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

From Richard Guo
Subject Re: Unexpected (wrong?) result querying boolean partitioned table with NULL partition
Date
Msg-id CAMbWs49OLBVCwuq7ucCio1x-x7DaaF+c5NkT=ZDOpwodFXPRkg@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  (David Rowley <dgrowleyml@gmail.com>)
List pgsql-hackers

On Thu, Apr 13, 2023 at 10:39 AM Richard Guo <guofenglinux@gmail.com> wrote:
On Wed, Apr 12, 2023 at 7:13 PM David Rowley <dgrowleyml@gmail.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

pgsql-hackers by date:

Previous
From: Julien Rouhaud
Date:
Subject: Re: pg_upgrade and logical replication
Next
From: Amit Kapila
Date:
Subject: Re: Should we remove vacuum_defer_cleanup_age?