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

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Quan Zongliang <quanzongliang@yeah.net>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2022-09-01T20:33:18Z
Lists: pgsql-hackers

Attachments

Quan Zongliang <quanzongliang@yeah.net> writes:
> 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.

This seems drastically underdocumented, and the test you're using
for extension opclasses is wrong.  What we need to know before
applying match_boolean_index_clause is that a clause using
BooleanEqualOperator will be valid for the index.  That's got next
door to nothing to do with whether the opclass is default for
the index AM.  A non-default opclass might support that operator,
and conversely a default one might not (although I concede it's
not that easy to imagine what other set of operators-on-boolean
an extension opclass might be interested in).

I think we need something more like the attached.

			regards, tom lane

Commits

  1. Fix planner to consider matches to boolean columns in extension indexes.