Re: BUG #19428: Lazy evaluation of type checking in CASE in SQL functions including subqueries no longer works in 18 - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #19428: Lazy evaluation of type checking in CASE in SQL functions including subqueries no longer works in 18
Date
Msg-id 4503.1773330394@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #19428: Lazy evaluation of type checking in CASE in SQL functions including subqueries no longer works in 18  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: BUG #19428: Lazy evaluation of type checking in CASE in SQL functions including subqueries no longer works in 18
List pgsql-bugs
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Thursday, March 12, 2026, Damian Lukowski <pgsql-bugs@arcsin.de> wrote:
>> The `data` table could have millions of rows. Is the planner invoked for
>> every actual call to `func`, or only once before any pages are read?

> IIRC the first five invocations will get replanned using the parameter as a
> constant; then after either every call will be replanned or none will.

Read up on custom vs. generic plans for some more background on this.

That behavior used to apply only to plpgsql functions, but since v18
SQL-language functions do it too.

            regards, tom lane



pgsql-bugs by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: BUG #19431: limitation of the data type jsonb equals 8Kb
Next
From: Tom Lane
Date:
Subject: Re: BUG #19431: limitation of the data type jsonb equals 8Kb