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

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Chris BSomething <xpusostomos(at)gmail(dot)com>
Cc: 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 15:30:18
Message-ID: CAKFQuwZ8HCXZF+dFhW809Zuv+Z6AStQ10kkFiYTC-f79d5U1Ug@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Nov 19, 2024 at 8:08 AM Chris BSomething <xpusostomos(at)gmail(dot)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.

"Replacing text with null is problematic, but no problem arises if there is
nothing to be done." - while true I see little desire to make that
conditionalized behavior reality. IOW, you are correct, but it also isn't
likely to change. The current behavior benefits developers over users, but
we make up for it by spending time elsewhere.

David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2024-11-19 16:47:40 Re: BUG #18715: replace() function silently fails if 3rd argument is null
Previous Message Chris BSomething 2024-11-19 15:07:42 Re: BUG #18715: replace() function silently fails if 3rd argument is null