Re: PG11 - Multiple Key Range Partition

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: PG11 - Multiple Key Range Partition
Дата
Msg-id CAKJS1f-QTS_uM9FwQT2-XVNjga=ueXifuYy-aTtb8OKWVKZOGQ@mail.gmail.com
обсуждение исходный текст
Ответ на PG11 - Multiple Key Range Partition  (Rares Salcudean <rares.salcudean@takeofflabs.com>)
Ответы Re: PG11 - Multiple Key Range Partition  (Amit Langote <amitlangote09@gmail.com>)
Список pgsql-bugs
On Wed, 10 Jul 2019 at 18:39, Rares Salcudean
<rares.salcudean@takeofflabs.com> wrote:
> I tested out your example and all works fine for me as well. But I live the main issue lies in the following
example:
>
> create table rangep (a bool, b bool, c date) partition by range (a,b,c);
>
> create table rangep1_recent partition of rangep for values from (true,false, '1990-01-01') to
(true,false,'2090-01-01');
> create table rangep1_deleted partition of rangep for values from (false,true, '1990-01-01') to
(false,true,'2090-01-01');
> create table rangep1_2019 partition of rangep for values from (false,false, '2019-01-01') to
(false,false,'2020-01-01');
> create table rangep1_2018 partition of rangep for values from (false,false, '2018-01-01') to
(false,false,'2019-01-01');
> create table rangep1_2017 partition of rangep for values from (false,false, '2017-01-01') to
(false,false,'2018-01-01');
>
> explain select * from rangep where not a and not b and c = '2019-07-10';

Thanks for making the test case. It is a bug.  There's a problem in
match_clause_to_partition_key() where because
match_boolean_partition_clause() returns false for the "NOT b"
condition when comparing to the first partition key this causes the
function to return PARTCLAUSE_UNSUPPORTED which causes the calling
function to not bother trying to match that qual up to any other
partition key. Effectively, for pruning the WHERE clause is just WHERE
NOT a AND c = '2019-07-10', so only the rangep1_recent partition is
pruned.

I'll look into fixing it. Thanks for the report.

-- 
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services



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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: BUG #15888: Bogus "idle in transaction" state for logicaldecoding client after creating a slot
Следующее
От: Amit Langote
Дата:
Сообщение: Re: FDW does not push down LIMIT & ORDER BY with sharding (partitions)