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

From: Erik Wienhold <ewie(at)ewie(dot)name>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Chris BSomething <xpusostomos(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18715: replace() function silently fails if 3rd argument is null
Date: 2024-11-19 23:31:12
Message-ID: 79a8f2c3-d44a-4876-b34f-d1a718f2aa79@ewie.name
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2024-11-19 23:40 +0100, Tom Lane wrote:
> Erik Wienhold <ewie(at)ewie(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2024-11-20 00:41:58 Re: pg_rewind WAL segments deletion pitfall
Previous Message Thomas Munro 2024-11-19 23:15:59 Re: [EXTERNAL] Re: BUG #18707: Installation issue