Re: PG11 - Multiple Key Range Partition
Amit Langote <amitlangote09@gmail.com>
From: Amit Langote <amitlangote09@gmail.com>
To: David Rowley <david.rowley@2ndquadrant.com>
Cc: Rares Salcudean <rares.salcudean@takeofflabs.com>, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2019-07-10T09:01:55Z
Lists: pgsql-bugs
On Wed, Jul 10, 2019 at 5:37 PM David Rowley <david.rowley@2ndquadrant.com> wrote: > 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. Oops, indeed a bug. Should've returned PARTCLAUSE_NOMATCH there. Thanks for taking it up. Regards, Amit
Commits
-
Fix RANGE partition pruning with multiple boolean partition keys
- cfde23493938 13.0 landed
- 30a268ed2e29 12.0 landed
- 757f1baa8c13 11.5 landed