pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Erik Wienhold <ewie@ewie.name>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: Chris BSomething <xpusostomos@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18715: replace() function silently fails if 3rd argument is null
Date: Wed, 20 Nov 2024 00:31:12 +0100
Message-ID: <79a8f2c3-d44a-4876-b34f-d1a718f2aa79@ewie.name> (raw)
In-Reply-To: <3966228.1732056048@sss.pgh.pa.us>
References: <18715-7035b5d78571887e@postgresql.org>
	<CAKFQuwaFtdrDPryMUfBy_+DnsrGishCuXHc+doVLjdczhWWP1w@mail.gmail.com>
	<CADrHaBGAgjGCG_d0=myn+Rq1qNSduDA=_f=B8bLRzQm=E-sL4g@mail.gmail.com>
	<CAKFQuwZ8HCXZF+dFhW809Zuv+Z6AStQ10kkFiYTC-f79d5U1Ug@mail.gmail.com>
	<3778528.1732034860@sss.pgh.pa.us>
	<c4804767-5c7e-4103-9d1e-0c6c2e3433d3@ewie.name>
	<3966228.1732056048@sss.pgh.pa.us>

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%40ma...
[2] https://www.postgresql.org/docs/current/functions.html

-- 
Erik





view thread (8+ messages)

Message-ID: <79a8f2c3-d44a-4876-b34f-d1a718f2aa79@ewie.name>
Permalink:  ../79a8f2c3-d44a-4876-b34f-d1a718f2aa79@ewie.name/
Also on:    postgresql.org/message-id/79a8f2c3-d44a-4876-b34f-d1a718f2aa79@ewie.name

 · 

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: pgsql-bugs@postgresql.org
  Cc: ewie@ewie.name, tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, xpusostomos@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18715: replace() function silently fails if 3rd argument is null
  In-Reply-To: <79a8f2c3-d44a-4876-b34f-d1a718f2aa79@ewie.name>

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

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