public inbox for [email protected]  
help / color / mirror / Atom feed
From: Damian Lukowski <[email protected]>
To: [email protected] <[email protected]>
Subject: Re: BUG #19428: Lazy evaluation of type checking in CASE in SQL functions including subqueries no longer works in 18
Date: Thu, 12 Mar 2026 13:49:44 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAKFQuwZN90TwSJJ=1zu88pkkC1e5c_wKDMsO5_849uwa2zDmhQ@mail.gmail.com>
References: <[email protected]>
	<[email protected]>
	<[email protected]>
	<CAKFQuwZN90TwSJJ=1zu88pkkC1e5c_wKDMsO5_849uwa2zDmhQ@mail.gmail.com>

> On Thursday, March 12, 2026, Damian Lukowski <[email protected]> wrote:
>
>>     We have never promised to avoid constant-folding within the
>>     subexpressions of a CASE [1].  So it was pure accident that
>>     this example worked before, and I don't think it's a bug that
>>     it doesn't work now.
>
>     For a better understanding, which one is the constant that is
>     being folded? I have found several articles explaining constant
>     folding but their examples are obvious, e.g. `7 + 1` can be folded
>     to `8` [1, 2], or `1 = 1` can be folded to `TRUE` [3].
>
>     However, I have not found any articles that resemble this case.
>     Aren't `arg` and `$1` variables? Where is the boundary between
>     constants and non-constants?
>
> The system is capable of postponing planning until (or performing 
> replanning) after parameter values are known, in which the values they 
> are given are constants.
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?

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: BUG #19428: Lazy evaluation of type checking in CASE in SQL functions including subqueries no longer works in 18
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox