regexp_matches bug in 9.3.4 and 9.4.1

From: Jeff Certain <gcertain(at)dynamicsignal(dot)com>
To: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: regexp_matches bug in 9.3.4 and 9.4.1
Date: 2015-05-04 16:56:51
Message-ID: BN1PR04MB37467AA1D412223B3D4A595DFD20@BN1PR04MB374.namprd04.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Repro:
drop table if exists regex_test;
create table regex_test(filter citext);
insert into regex_test(filter) values ('Filter Filter Filter');
select filter, regexp_matches(filter, 'Filter', 'g') from regex_test;
select filter, regexp_matches('Filter Filter Filter', 'Filter', 'g') from regex_test;

Expected result:
Both select statements should return the same number of rows. Specifically, in this case, I expect to get back 3 rows.

Actual result:
When referencing the filter column, only one row is ever returned. When supplying the string that is the same as the data in the filter column, the correct number of rows are returned.

Result 1 (incorrect):
select filter, regexp_matches(filter, 'Filter', 'g') from regex_test;
Filter Filter Filter {Filter}

Result 2 (correct):
select filter, regexp_matches('Filter Filter Filter', 'Filter', 'g') from regex_test;
Filter Filter Filter {Filter}
Filter Filter Filter {Filter}
Filter Filter Filter {Filter}

Versions
PostgreSQL 9.3.4, compiled by Visual C++ build 1600, 64-bit
PostgreSQL 9.4.1 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11), 64-bit

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Haas 2015-05-04 18:46:34 Re: Re: BUG #12990: Missing pg_multixact/members files (appears to have wrapped, then truncated)
Previous Message Amit Kapila 2015-05-04 11:49:32 Re: Re: BUG #12990: Missing pg_multixact/members files (appears to have wrapped, then truncated)