Re: [PATCH] Add planner support function to two-argument regexp_like()

From: solai v <solai(dot)cdac(at)gmail(dot)com>
To: shihao zhong <zhong950419(at)gmail(dot)com>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, jian he <jian(dot)universality(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Add planner support function to two-argument regexp_like()
Date: 2026-12-02 07:26:37
Message-ID: CAF0whucCkLwF67oivYQTjWQxORYMe96FGfzoRCyghN4zvuzedA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

On Tue, Dec 1, 2026 at 3:18 PM shihao zhong <zhong950419(at)gmail(dot)com> wrote:
>
> Hi Fujii-san,
>
> Thanks, good catch.
>
> 0001 in v4 makes starts_with() and the LIKE and regex functions use
> statistics on the call. 0002 is the regexp_like() patch on top. Your
> example now estimates 8000 rows. Operators are unchanged. Both are
> master only.
>
>

Thank you for the updated patches. I have tested both patches in the
v4 series and the regression tests completed without failures. I have
verified that the two-argument regexp_like() now generates an index
condition for fixed-prefix patterns, similar to the ~ operator and
have also verified that the expression statistics improve row-count
estimates for Boolean-valued function calls.
I would like to put forward a few suggestions for considerations:
1. The statistics regression test currently exercises starts_with(),
which uses the shared like_regex_support() implementation. Would it be
useful to add a direct test for expression statistics on regexp_like()
as well?
2. The new statistics check is applied only to restriction selectivity
requests (!req->is_join). Would it be useful to add a regression test
to document the intended behaviour for join selectivity requests,
where this function-call statistics check is skipped?

Overall, the patches worked as expected in the scenarios I tested, and
I did not identify any definite correctness issues.

Regards,
Solai

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2026-12-02 07:26:43 Re: Missing CFI() in SplitIdentifierString
Previous Message Kirill Reshke 2026-12-02 07:09:25 DROP USER MAPPING doesn't acquire lock on its server