Re: BUG #18715: replace() function silently fails if 3rd argument is null - Mailing list pgsql-bugs

From Erik Wienhold
Subject Re: BUG #18715: replace() function silently fails if 3rd argument is null
Date
Msg-id 79a8f2c3-d44a-4876-b34f-d1a718f2aa79@ewie.name
Whole thread Raw
In response to Re: BUG #18715: replace() function silently fails if 3rd argument is null  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On 2024-11-19 23:40 +0100, Tom Lane wrote:
> Erik Wienhold <ewie@ewie.name> writes:
> > On 2024-11-19 17:47 +0100, Tom Lane wrote:
> >> 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
> 
> I did see that one, but it's not exactly in an obvious-to-novices
> place.
> 
> David was working on a new docs section that would talk more about
> SQL NULLs in general.  Maybe that would be a reasonable place?

Definitely.  Looking at David's v4 patch [1] right now, I see that it
already covers strict functions (new section "Null-Valued Arguments in
Normal Function Calls").

> An alternative could be somewhere early in func.sgml, but that chapter
> doesn't really have anything I would call an overview section.

We have this intro page [2] which explains the notation used throughout
the chapter.  How about mentioning there that all functions in this
chapter, unless stated otherwise, return NULL when called with any NULL
arguments?

[1] https://www.postgresql.org/message-id/CAKFQuwbHuT82b3jYwH%2ByhuKrpLoa0Ebr%2BsT6mTFS%2BnfjAAGUFQ%40mail.gmail.com
[2] https://www.postgresql.org/docs/current/functions.html

-- 
Erik



pgsql-bugs by date:

Previous
From: Thomas Munro
Date:
Subject: Re: [EXTERNAL] Re: BUG #18707: Installation issue
Next
From: Bing Xu
Date:
Subject: RE: BUG #18635: " $libdir/adminpack could not be loaded" error with pg_upgrade to PostgreSQL17