-- Then I use the results foreach i_string slice 1 in array i_strings loop raise notice 'row = %',i_string; end loop;
when I run the function like this:
select test('1:Warehouse1;2:Warehouse2;');
postgresql complains: ERROR: query "SELECT regexp_matches(v_string,E'[a-zA-Z0-9:\\s\\-\\.#%]*:[A-Za-z0-9\\s\\-\\.#%]+','g')" returned more than one row
Why postgres is sending the ERROR?
Off course I am expecting more than one row!, that's why is in a foreach loop in the first place.
If I run: select regexp_matches('1:Warehouse1;2:Warehouse2;',E'[a-zA-Z0-9:\\s\\-\\.#%]*:[A-Za-z0-9\\s\\-\\.#%]+','g'); regexp_matches ---------------- {1:Warehouse1} {2:Warehouse2} (2 rows)