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 r=
egex_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 sup=
plying the string that is the same as the data in the filter column, the co=
rrect 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 r=
egex_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 2=
0120313 (Red Hat 4.4.7-11), 64-bit