From: Tom Lane <tgl@sss.pgh.pa.us>
To: Vee <sefer@hotmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #5273: Unexpected function behavior/failure
Date: Tue, 12 Jan 2010 19:45:44 -0500
Message-ID: <29476.1263343544@sss.pgh.pa.us> (raw)
In-Reply-To: <201001122230.o0CMUWFS000320@wwwmaster.postgresql.org>
References: <201001122230.o0CMUWFS000320@wwwmaster.postgresql.org>
"Vee" <sefer@hotmail.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
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: tgl@sss.pgh.pa.us, sefer@hotmail.com
Subject: Re: BUG #5273: Unexpected function behavior/failure
In-Reply-To: <29476.1263343544@sss.pgh.pa.us>
* 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