Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tDXgu-001RP2-7O for pgsql-bugs@arkaria.postgresql.org; Tue, 19 Nov 2024 23:31:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tDXgs-000dcZ-AH for pgsql-bugs@arkaria.postgresql.org; Tue, 19 Nov 2024 23:31:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tDXgr-000dcN-W4 for pgsql-bugs@lists.postgresql.org; Tue, 19 Nov 2024 23:31:26 +0000 Received: from mout-u-204.mailbox.org ([2001:67c:2050:101:465::204]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tDXgo-002m4s-PD for pgsql-bugs@lists.postgresql.org; Tue, 19 Nov 2024 23:31:24 +0000 Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-204.mailbox.org (Postfix) with ESMTPS id 4XtLNM1zrTz9tYk; Wed, 20 Nov 2024 00:31:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ewie.name; s=MBO0001; t=1732059075; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5k7ytVpB8kvzFoYMStNhqrvZX39EibSI0GNC7hzKqus=; b=JAnUDhzx8JgnF9OF5uIoje/qEvPs6XE/GD202HgylSQqyTi6vDHL5apMoDZO1IL/o2Y1Xi aiBmMI3Ne5oSG8H1SuIxbe/xk1hfIqlNTqbzO6C00jaupM9R9eq72GV27MouTXU/aEyVLc bedkNXtsyUJRsqwgLxBLKoeQDI1HxoFq4SE2KTr1ULKBKN2FcY/3O/gahlrXuWSePzsoUy IfQKUzUsdleSMH0rTa8UB/8RIsHiIBQovXVRtqx52angLxtFnuYLNke9/jFpYYAY6Oh1id 2KGEnk9E8HKXk6rG79ZKtAeNhOGE3UotlX1FNBsYZfX+52ykk6T40Fasg02vTA== Date: Wed, 20 Nov 2024 00:31:12 +0100 From: Erik Wienhold To: Tom Lane Cc: "David G. Johnston" , Chris BSomething , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18715: replace() function silently fails if 3rd argument is null Message-ID: <79a8f2c3-d44a-4876-b34f-d1a718f2aa79@ewie.name> References: <18715-7035b5d78571887e@postgresql.org> <3778528.1732034860@sss.pgh.pa.us> <3966228.1732056048@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3966228.1732056048@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2024-11-19 23:40 +0100, Tom Lane wrote: > Erik Wienhold 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