Re: [PATCH] kNN for btree

From: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, David Steele <david(at)pgmasters(dot)net>, Anastasia Lubennikova <lubennikovaav(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] kNN for btree
Date: 2019-09-08 20:35:47
Message-ID: CAPpHfdtcVkX6CAL-dZj9WVUY6-RQhjdyYxiuV+eObrFGRm0v1w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 3, 2019 at 2:19 AM Alvaro Herrera <alvherre(at)2ndquadrant(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-09-08 21:01:20 pgsql: Fix RelationIdGetRelation calls that weren't bothering with erro
Previous Message Peter Eisentraut 2019-09-08 20:27:49 Re: BUG #15977: Inconsistent behavior in chained transactions