Re: regexp_replace( , , , NULL ) returns null?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jim Nasby <jnasby(at)enova(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: regexp_replace( , , , NULL ) returns null?
Date: 2014-05-03 01:57:10
Message-ID: 1440.1399082230@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jim Nasby <jnasby(at)enova(dot)com> writes:
> Is there any particular reason for this:
> decibel(at)decina(dot)local=# SELECT regexp_replace( 'a', 'a', 'b', null ) IS NULL;
> ?column?
> ----------
> t
> (1 row)

Yeah: regexp_replace is strict.

> ISTM itd be a lot better if it treated NULL flags the same as ...

In Oracle's universe that probably makes sense, but to me it's not
sensible. Why should "unknown" flags produce a non-unknown result?

I find it hard to envision many use-cases where you wouldn't actually
have the flags as a constant, anyway; they're too fundamental to the
behavior of the function.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-05-03 02:32:15 Re: Faster array_length()
Previous Message Josh Berkus 2014-05-03 01:57:08 New and interesting replication issues with 9.2.8 sync rep