Amit Langote wrote:
> Ah, I think I got it after staring at the (btree) index code for a bit.
>
> What pruning code got wrong is that it's comparing the expression type
> (type of the constant arg that will be compared with partition bound
> datums when pruning) with the partopcintype to determine if we should look
> up the cross-type comparison/hashing procedure, whereas what the latter
> should be compare with is the clause operator's oprighttype. ISTM, if
> op_in_opfamily() passed for the operator, that's the correct thing to do.
I wonder why you left out the hash partitioning case? I don't really
know that this is correct, but here's a delta patch as demonstration.
(v3 is your patch, I think the only change is I renamed the tables used
in the test)
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services