Re: BUG #18715: replace() function silently fails if 3rd argument is null

Erik Wienhold <ewie@ewie.name>

From: Erik Wienhold <ewie@ewie.name>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: "David G. Johnston" <david.g.johnston@gmail.com>, Chris BSomething <xpusostomos@gmail.com>, pgsql-bugs@lists.postgresql.org
Date: 2024-11-19T22:34:23Z
Lists: pgsql-bugs
On 2024-11-19 17:47 +0100, Tom Lane wrote:
> "David G. Johnston" <david.g.johnston@gmail.com> writes:
> > On Tue, Nov 19, 2024 at 8:08 AM Chris BSomething <xpusostomos@gmail.com>
> > wrote:
> >> Nowhere (that I can see) does any documentation "define" that replace
> >> returns null on null input to arg 3. Nor is it obvious that any "strict"
> >> application of any principle should have it return null.
> 
> > Fair, I keep forgetting that we don't document the "strict" property of a
> > function definition.  Absent that, I agree it's a documentation bug that we
> > don't adequately explain the strictness behavior of this function.
> 
> I thought we documented somewhere that built-in functions are strict
> unless explicitly stated otherwise ... but I sure can't find that
> statement right now.

Perhaps this one?:
> (Most internal functions expect to be declared “strict”.)
https://www.postgresql.org/docs/current/xfunc-internal.html

-- 
Erik