Re: bug with expression index on partition

2018-06-25 Thread Amit Langote
On 2018/06/23 6:51, Alvaro Herrera wrote: > On 2018-Jun-21, Amit Langote wrote: > >> explain (costs off) select p from p order by p; >> QUERY PLAN >> --- >> Merge Append >>Sort Key: ((p1.*)::p) >>-> Index Scan using p1_p_idx on p1 >>-

Re: bug with expression index on partition

2018-06-24 Thread Amit Langote
On 2018/06/23 5:54, Alvaro Herrera wrote: > On 2018-Jun-21, Amit Langote wrote: > >> On 2018/06/21 15:35, Amit Langote wrote: >>> So, CompareIndexInfo and generateClonedIndexStmt are both doing the right >>> thing, but DefineIndex is not. Attached is a patch to fix DefineIndex so >>> that it conv

Re: bug with expression index on partition

2018-06-22 Thread Alvaro Herrera
On 2018-Jun-21, Amit Langote wrote: > explain (costs off) select p from p order by p; > QUERY PLAN > --- > Merge Append >Sort Key: ((p1.*)::p) >-> Index Scan using p1_p_idx on p1 >-> Index Scan using p2_p_idx on p2 >-> Index Sca

Re: bug with expression index on partition

2018-06-22 Thread Alvaro Herrera
On 2018-Jun-21, Amit Langote wrote: > On 2018/06/21 15:35, Amit Langote wrote: > > So, CompareIndexInfo and generateClonedIndexStmt are both doing the right > > thing, but DefineIndex is not. Attached is a patch to fix DefineIndex so > > that it converts indexParams before recursing to create the

Re: bug with expression index on partition

2018-06-21 Thread Amit Langote
On 2018/06/21 16:19, Amit Langote wrote: > I updated the patch so that even DefineIndex will check if any whole-row > Vars were encountered during conversion and error out if so. I first thought of starting a new thread for this, but thought I'd just reply here because the affected code is nearby.

Re: bug with expression index on partition

2018-06-21 Thread Amit Langote
On 2018/06/21 15:35, Amit Langote wrote: > So, CompareIndexInfo and generateClonedIndexStmt are both doing the right > thing, but DefineIndex is not. Attached is a patch to fix DefineIndex so > that it converts indexParams before recursing to create the index on a > partition. I noticed that whil

bug with expression index on partition

2018-06-20 Thread Amit Langote
Hi. I noticed a bug with creating an expression index on a partitioned table. The fact that a partition may have differing attribute numbers is not accounted for when recursively *creating* the index on partition. The partition index gets created but is unusable. create table p (a int) partition