Re: BUG #5273: Unexpected function behavior/failure

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Vee" <sefer(at)hotmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5273: Unexpected function behavior/failure
Date: 2010-01-13 00:45:44
Message-ID: 29476.1263343544@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Vee" <sefer(at)hotmail(dot)com> writes:
> -- The problem query
> select data, regexp_matches(data, '(h..l)')
> from test;

>> hello {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. regexp_matches() returns setof something, meaning a row per match.
When you have no match, you get no rows. And 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().

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Haas 2010-01-13 01:48:36 Re: BUG #5273: Unexpected function behavior/failure
Previous Message Vee 2010-01-12 22:30:32 BUG #5273: Unexpected function behavior/failure