Re: Use opresulttype instead of calling SearchSysCache1() in match_orclause_to_indexcol()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tender Wang <tndrwang(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Use opresulttype instead of calling SearchSysCache1() in match_orclause_to_indexcol()
Date: 2025-09-19 16:16:01
Message-ID: 2136099.1758298561@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tender Wang <tndrwang(at)gmail(dot)com> writes:
> While working on another issue, I stepped into match_orclause_to_indexcol().
> I found below codes:

> /* Only the operator returning a boolean suit the transformation. */
> if (get_op_rettype(opno) != BOOLOID)
> break;

I don't understand what purpose this check serves at all.
We are looking at an arm of an OR clause, so it had better
yield boolean.

If anything, this is actively wrong, because for example it'd
reject a polymorphic operator that yields boolean in-context.

In general, this code looks like a mess. There are a lot of
Asserts that might be okay in development but probably should
not have got committed, and the comments need work.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-09-19 16:17:58 Re: Having postgresql.org link to cgit instead of gitweb
Previous Message Yugo Nagata 2025-09-19 15:21:19 Re: Suggestion to add --continue-client-on-abort option to pgbench