Re: replace() using NULL - Mailing list pgsql-bugs

From Julien Rouhaud
Subject Re: replace() using NULL
Date
Msg-id Yla1RQYrF9Qn3GR3@jrouhaud
Whole thread Raw
In response to replace() using NULL  (Susanne Holzgraefe <miracee@web.de>)
Responses Re: replace() using NULL
List pgsql-bugs
Hi,

On Wed, Apr 13, 2022 at 10:38:28AM +0200, Susanne Holzgraefe wrote:
>
> tested by using postgresql 13.5:
>
> SELECT REPLACE('xyz‘, ’y’, ’a’); => xaz => expected
> SELECT REPLACE('xyz', 'a‘, 'b‘); => xyz => expected
>
> SELECT REPLACE('xyz‘, 'a‘, NULL); => NULL
>
> Also tested by using MariaDB. Same behavior like in PG.
> Tested with Oracle, result is ‚xyz‘.
>
> That is what I would expect because xyz includes no a.
>
> I neither can find any documentation about this nor a bug report.

The function is declared as STRICT, which means that it won't be called at all
and just returns NULL if any of its parameters is NULL.

Maybe oracle supports such calls as it supports NULL bytes in strings (I
think), but postgres doesn't.



pgsql-bugs by date:

Previous
From: Susanne Holzgraefe
Date:
Subject: replace() using NULL
Next
From: Tom Lane
Date:
Subject: Re: replace() using NULL