Severity: major (data loss)
Versions Tested: 8.4.2, 9.0 HEAD
Test Case:
create table regex_test ( id serial not null primary key, myname text );
insert into regex_test ( myname )
values ( 'josh'),('joe'),('mary'),('stephen'), ('jose'),
('kelley'),('alejandro');
select id, regexp_matches(myname, $x$(j[\w]+)$x$)
from regex_test;
The above will return 4 rows, not the 7 which are in the table.
I can't see how this is anything but a bug; as far as I know, nothing in
the target list is allowed to restrict the number of rows which are
returned by the query. We should get 7 rows, 3 of which have an empty
array or a NULL in the 2nd column.
--
-- Josh Berkus
PostgreSQL Experts Inc.
http://www.pgexperts.com