Re: Bug: When user-defined AM is used, the index path cannot be selected correctly

From: Quan Zongliang <quanzongliang(at)yeah(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bug: When user-defined AM is used, the index path cannot be selected correctly
Date: 2022-08-17 09:11:43
Message-ID: 7f498182-6736-8fee-d2fe-452e336de795@yeah.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2022/8/17 10:03, Tom Lane wrote:
> Quan Zongliang <quanzongliang(at)yeah(dot)net> writes:
>> 1. When using extended PGroonga
>> ...
>> 3. Neither ID = 'f' nor id= 't' can use the index correctly.
>
> This works fine for btree indexes. I think the actual problem
> is that IsBooleanOpfamily only accepts the btree and hash
> opclasses, and that's what needs to be improved. Your proposed
> patch fails to do that, which makes it just a crude hack that
> solves some aspects of the issue (and probably breaks other
> things).
>
> It might work to change IsBooleanOpfamily so that it checks to
> see whether BooleanEqualOperator is a member of the opclass.
> That's basically what we need to know before we dare generate
> substitute index clauses. It's kind of an expensive test
> though, and the existing coding assumes that IsBooleanOpfamily
> is cheap ...
>
> regards, tom lane

New patch attached.

It seems that partitions do not use AM other than btree and hash.
Rewrite only indxpath.c and check if it is a custom AM.

Attachment Content-Type Size
indxpath.patch text/plain 1.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2022-08-17 09:25:53 Re: Making Vars outer-join aware
Previous Message Bharath Rupireddy 2022-08-17 08:29:58 Re: Generalize ereport_startup_progress infrastructure