pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Julien Rouhaud <rjuju123@gmail.com>
To: Susanne Holzgraefe <miracee@web.de>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: replace() using NULL
Date: Wed, 13 Apr 2022 19:34:29 +0800
Message-ID: <Yla1RQYrF9Qn3GR3@jrouhaud> (raw)
In-Reply-To: <29A17362-1756-422E-9BD3-2CBE9F8C990F@web.de>
References: <29A17362-1756-422E-9BD3-2CBE9F8C990F@web.de>

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.





view thread (3+ messages)  latest in thread

Message-ID: <Yla1RQYrF9Qn3GR3@jrouhaud>
Permalink:  ../Yla1RQYrF9Qn3GR3@jrouhaud/
Also on:    postgresql.org/message-id/Yla1RQYrF9Qn3GR3@jrouhaud

 · 

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: rjuju123@gmail.com, miracee@web.de, pgsql-bugs@lists.postgresql.org
  Subject: Re: replace() using NULL
  In-Reply-To: <Yla1RQYrF9Qn3GR3@jrouhaud>

* 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