Re: Unexpected (wrong?) result querying boolean partitioned table with NULL partition
От | Richard Guo |
---|---|
Тема | Re: Unexpected (wrong?) result querying boolean partitioned table with NULL partition |
Дата | |
Msg-id | CAMbWs48x1jvE8Ab67Xbe8odLh96uLhw=DQi6oiQqBTvkyD7xnw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Unexpected (wrong?) result querying boolean partitioned table with NULL partition (David Rowley <dgrowleyml@gmail.com>) |
Ответы |
Re: Unexpected (wrong?) result querying boolean partitioned table with NULL partition
|
Список | pgsql-hackers |
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.
+ 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
+ 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
В списке pgsql-hackers по дате отправления: