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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Damian Lukowski <pgsql-bugs(at)arcsin(dot)de>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #19428: Lazy evaluation of type checking in CASE in SQL functions including subqueries no longer works in 18
Date: 2026-03-12 15:46:34
Message-ID: 4503.1773330394@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Thursday, March 12, 2026, Damian Lukowski <pgsql-bugs(at)arcsin(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2026-03-12 15:55:24 Re: BUG #19431: limitation of the data type jsonb equals 8Kb
Previous Message Andrew Dunstan 2026-03-12 14:09:03 Re: BUG #19431: limitation of the data type jsonb equals 8Kb