Re: PG11 - Multiple Key Range Partition

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
Cc: Rares Salcudean <rares(dot)salcudean(at)takeofflabs(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: PG11 - Multiple Key Range Partition
Date: 2019-07-10 09:01:55
Message-ID: CA+HiwqFF=m6Z2TrPnSJ5fEVtxa=-hPp71QgpNJtCicr2eeziKQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Jul 10, 2019 at 5:37 PM David Rowley
<david(dot)rowley(at)2ndquadrant(dot)com> wrote:
> On Wed, 10 Jul 2019 at 18:39, Rares Salcudean
> <rares(dot)salcudean(at)takeofflabs(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Haribabu Kommi 2019-07-10 09:08:46 Re: BUG #15889: PostgreSQL failed to build due to error MSB8020 with MSVC on windows
Previous Message Amit Langote 2019-07-10 08:47:55 Re: FDW does not push down LIMIT & ORDER BY with sharding (partitions)