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 02:39:03 |
Message-ID: | CAMbWs48x1jvE8Ab67Xbe8odLh96uLhw=DQi6oiQqBTvkyD7xnw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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.
+ switch (btest->booltesttype)
+ {
+ case IS_NOT_TRUE:
+ *noteq = true;
+ /* fall through */
+ case IS_TRUE:
+ *outconst = (Expr *) makeBoolConst(true, false);
+ break;
+ case IS_NOT_FALSE:
+ *noteq = true;
+ /* fall through */
+ case IS_FALSE:
+ *outconst = (Expr *) makeBoolConst(false, false);
+ break;
+ default:
+ Assert(false); /* hmm? */
+ return PARTCLAUSE_UNSUPPORTED;
+ }
The *outconst should be set to true in case IS_NOT_FALSE and set to
false in case IS_NOT_TRUE, something like:
switch (btest->booltesttype)
{
- case IS_NOT_TRUE:
+ case IS_NOT_FALSE:
*noteq = true;
/* fall through */
case IS_TRUE:
*outconst = (Expr *) makeBoolConst(true, false);
break;
- case IS_NOT_FALSE:
+ case IS_NOT_TRUE:
*noteq = true;
/* fall through */
case IS_FALSE:
Thanks
Richard
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Smith | 2023-04-13 02:42:05 | Re: pg_upgrade and logical replication |
Previous Message | Amit Kapila | 2023-04-13 02:32:07 | Re: Non-superuser subscription owners |