Re: BUG #18344: Pruning tables partitioned by bool range fails with invalid strategy

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: BUG #18344: Pruning tables partitioned by bool range fails with invalid strategy
Дата
Msg-id CAApHDvpW6N38TerNpHuvXSZ3NHMpQr+G0R8fqvj1wD9ocCeRsA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #18344: Pruning tables partitioned by bool range fails with invalid strategy  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: BUG #18344: Pruning tables partitioned by bool range fails with invalid strategy  (Tender Wang <tndrwang@gmail.com>)
Re: BUG #18344: Pruning tables partitioned by bool range fails with invalid strategy  (Amit Langote <amitlangote09@gmail.com>)
Re: BUG #18344: Pruning tables partitioned by bool range fails with invalid strategy  (Alexander Lakhin <exclusion@gmail.com>)
Список pgsql-bugs
On Mon, 19 Feb 2024 at 05:25, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> David Rowley <dgrowleyml@gmail.com> writes:
> > We can do the same for BooleanTests. Given a clause such as: "partkey
> > IS NOT false", we can just generate the clause "partkey IS true OR
> > partkey IS NULL" and recursively generate steps for that.
>
> +1 ... sounds clean and clearly correct.

Here's a more complete patch for this.  I included some tests for LIST
and RANGE partitioned tables. I did manual testing for HASH, and was
on the fence about covering that too.

I did try the following using the table from the tests:

select * from boolrangep where a is not true and not b and c = 25 and
a is not null;

When will be effectively transformed into:

select * from boolrangep where (a is false or a is null) and not b and
c = 25 and a is not null;

It seems that's unable to prune the NULL partition but that mostly
seems to be due to a limitation of the current design. I'm not sure
it's worth going to any additional trouble to make that work.  It
seems a bit unlikely, especially so given how long the BooleanTest
pruning stuff was broken for before anyone noticed.

> > I'm tempted to go a bit further in master only and add support for
> > bool IS NOT UNKNOWN and bool IS UNKNOWN using the same method.
>
> These are the same as IS NOT NULL and IS NULL, so I don't see the
> need for an OR?

Uh, yeah. True. That makes it even more simple. Just use
PARTCLAUSE_MATCH_NULLNESS.

David

Вложения

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #18344: Pruning tables partitioned by bool range fails with invalid strategy
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: BUG #18350: Modifying predefined roles' unlimited connections for VA STIG cybersecurity checklist