Re: maybe incorrect regexp_replace behavior in v8.3.4 ?

From: Richard Huxton <dev(at)archonet(dot)com>
To: "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: maybe incorrect regexp_replace behavior in v8.3.4 ?
Date: 2012-05-16 14:14:06
Message-ID: 4FB3B62E.2070409@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 16/05/12 14:54, Gauthier, Dave wrote:
> bi_hsx_a0_latest=# select regexp_replace('xxx','^xxxy$',null);
> regexp_replace
> ----------------
>
> (1 row)
> But why did it return null in this case? I would think no match would leave it 'xxx'.

If a function is defined as "strict" then any null parameters
automatically result in a null result.

And indeed, this:
SELECT * FROM pg_proc WHERE proname LIKE 'regexp_r%';
shows pro_isstrict is set to true, as it is for most other function.s

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2012-05-16 14:15:45 Re: maybe incorrect regexp_replace behavior in v8.3.4 ?
Previous Message Vibhor Kumar 2012-05-16 14:08:02 Re: casting behavior of oids and relation names