Question re regexexp_split_to_array and last oc

Поиск
Список
Период
Сортировка
От Mike Martin
Тема Question re regexexp_split_to_array and last oc
Дата
Msg-id CAOwYNKaJDthPrxYtt7e9Nkm6=n-3Tff=VRzEPsObqWWox5k+hA@mail.gmail.com
обсуждение исходный текст
Список pgsql-sql
Hi
I have the following in a trigger (update/insert)
 NEW.filearr := (regexp_split_to_array(NEW.tagfile,'(?:/|\.)'))[2:];

This works except when there is a period in the filename

So I did this instead

arrfile=(regexp_split_to_array(NEW.tagfile,'/'))[2:];
NEW.filearr :=arrfile[1:cardinality(arrfile)-1]||regexp_matches(arrfile[cardinality(arrfile)],'(.*)\.(.*)');

Which works perfectly, except performance is 50% slower on a dataset of around 20k

Is there a better solution

Mike

В списке pgsql-sql по дате отправления:

Предыдущее
От: Mike Martin
Дата:
Сообщение: Qusetion re regexexp_split_to_array and last occurence
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: Qusetion re regexexp_split_to_array and last occurence