Re: BUG #5273: Unexpected function behavior/failure - Mailing list pgsql-bugs

From Robert Haas
Subject Re: BUG #5273: Unexpected function behavior/failure
Date
Msg-id 603c8f071001121748u1dd53f7ai2fe60a310d500019@mail.gmail.com
Whole thread Raw
In response to Re: BUG #5273: Unexpected function behavior/failure  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Tue, Jan 12, 2010 at 7:45 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> "Vee" <sefer@hotmail.com> writes:
>> -- The problem query
>> select data, regexp_matches(data, '(h..l)')
>> from test;
>
>>> hello =A0 =A0 =A0 =A0{hell}
>
>> Since I have no "where" clause, I would expect to see all the rows in the
>> result of the second case, with possibly a NULL value for the non-matched
>> rows.
>
> No. =A0regexp_matches() returns setof something, meaning a row per match.
> When you have no match, you get no rows. =A0And that in turn means that
> the calling select produces no rows --- just as it could also produce
> more than one row from a given table row.
>
> I think the behavior you are after is probably more like that of
> substring().

Or maybe the ~ operator.

...Robert

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #5273: Unexpected function behavior/failure
Next
From: Tom Lane
Date:
Subject: Re: BUG #5269: postgres backend terminates with SIGSEGV