Re: patch adding new regexp functions

Поиск
Список
Период
Сортировка
От Jeremy Drake
Тема Re: patch adding new regexp functions
Дата
Msg-id Pine.BSO.4.64.0702172207530.18849@resin.csoft.net
обсуждение исходный текст
Ответ на Re: patch adding new regexp functions  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: patch adding new regexp functions  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-patches
Attached, please find a new version of the patch which follows Tom's
advice (except regexp_matches returing a 2-D array, which I am not sure if
it is required/desired).  Hopefully this version makes everyone happy ;)

On Sat, 17 Feb 2007, Tom Lane wrote:

> So I'd vote against complicating the API in order to make special
> provision for these results.  I claim that all we need is a function
> taking (string text, pattern text, flags text) and returning either
> array of text or setof text containing the matched substrings in
> whatever order is standard (order by left-parenthesis position,
> I think).  In the degenerate case where there are no parenthesized
> subpatterns, just return the whole match as a single element.

The signature is

regexp_matches(string text, pattern text[, flags text]) returns setof
text[]

and behaves as described.

>
> As for the argument about array vs setof, I could see doing both to
> end the argument of which one is really superior for any particular
> problem.

regexp_split(string text, pattern text[, flags text]) returns setof text

regexp_split_array(string text, pattern text[. flags text[, limit int]])
returns text[]


--
When I was in school, I cheated on my metaphysics exam:
I looked into the soul of the boy sitting next to me.
        -- Woody Allen

Вложения

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [BUGS] BUG #2977: dow doesn't conform to ISO-8601
Следующее
От: Greg Smith
Дата:
Сообщение: Re: WIP patch - INSERT-able log statements