regexp_matches illegally restricts rows

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: regexp_matches illegally restricts rows
Date: 2010-04-06 04:16:23
Message-ID: 4BBAB597.6000409@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Josh Berkus 2010-04-06 05:06:46 Re: regexp_matches illegally restricts rows -- just a documentation issue?
Previous Message Robert Haas 2010-04-05 21:43:21 Re: dividing money by money