Ooops! The following comment is wrong. Please ignore it. At Fri, 10 Nov 2017 14:38:11 +0900 (Tokyo Standard Time), Kyotaro HORIGUCHI <horiguchi.kyot...@lab.ntt.co.jp> wrote in <20171110.143811.97616847.horiguchi.kyot...@lab.ntt.co.jp> > Those two conditions are not orthogonal. Maybe something like > following seems more understantable. > > > if (!constfalse) > > { > > /* No constraints on the keys, so, return *all* partitions. */ > > if (nkeys == 0) > > return bms_add_range(result, 0, partdesc->nparts - 1); > > > > result = get_partitions_for_keys(relation, &keys); > > } > > I'm not sure what is meant to be (formally) done here, but it > seems to me that OrExpr is assumed to be only at the top level of > the caluses. So the following (just an example, but meaningful > expression in this shpape must exists.) expression is perhaps > wrongly processed here. > > CREATE TABLE p (a int) PARITION BY (a); > CREATE TABLE c1 PARTITION OF p FOR VALUES FROM (0) TO (10); > CREATE TABLE c2 PARTITION OF p FOR VALUES FROM (10) TO (20); > > SELECT * FROM p WHERE a = 15 AND (a = 15 OR a = 5); > > get_partitions_for_keys() returns both c1 and c2 and still > or_clauses here holds (a = 15 OR a = 5) and the function tries to > *add* partitions for a = 15 and a = 5 separetely.
This is working fine. Sorry for the bogus comment. regards, -- Kyotaro Horiguchi NTT Open Source Software Center -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers