Re: pruning disabled for array, enum, record, range type partitionkeys - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: pruning disabled for array, enum, record, range type partitionkeys
Date
Msg-id 20180417221118.6jxa42h3k37eof6d@alvherre.pgsql
Whole thread Raw
In response to Re: pruning disabled for array, enum, record, range type partitionkeys  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Responses Re: pruning disabled for array, enum, record, range type partitionkeys  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
List pgsql-hackers
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

Attachment

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: PostgreSQL's handling of fsync() errors is unsafe and risks data loss at least on XFS
Next
From: Thomas Munro
Date:
Subject: Re: [sqlsmith] Unpinning error in parallel worker