On Tue, Sep 3, 2019 at 2:19 AM Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
>
> On 2019-Sep-03, Alexander Korotkov wrote:
>
> > I think patches 0001-0008 are very clear and extends our index-AM
> > infrastructure in query straightforward way. I'm going to propose
> > them for commit after some further polishing.
>
> Hmm. Why is 0001 needed? I see that 0005 introduces a call to that
> function, but if attnum == 0 then it doesn't call it. Maybe it was
> necessary in an older version of the patch?
Regarding "attno >= 1" check I agree with you. It should be changed
to assert. But "attno <= rd_index->indnkeyatts" check appears to be
needed for current code already. It appears that gistproperty() can
ask get_index_column_opclass() for non-key attribute. Then
get_index_column_opclass() returns garbage past oidvector value.
Typically get_opclass_opfamily_and_input_type() doesn't find this
garbage opclass oid and gistproperty() returns null as expected. But
this is bug and needs to be fixed.
I'm going to push 0001 changing "attno >= 1" to assert.
------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company