Re: patch adding new regexp functions

Поиск
Список
Период
Сортировка
От Jeremy Drake
Тема Re: patch adding new regexp functions
Дата
Msg-id Pine.BSO.4.64.0702171124190.18849@resin.csoft.net
обсуждение исходный текст
Ответ на Re: patch adding new regexp functions  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: patch adding new regexp functions  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches
Finally the voice of reason :)
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

For this function, it would be setof array of text, as the capture groups
would definitely go in an array, but if you asked for global in the flags,
there could be more than one match in the string.

> 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.

Good idea, that did not occur to me.  I was planning to throw an error in
that case.

> 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.

The array vs setof argument was on the split function.  I will work on
doing both.  Any idea how the name and/or arguments should differ?  I
think that an optional limit argument for the array version like perl has
would be reasonable, but a name difference in the functions is probably
necessary to avoid confusion.


--
Speaking of Godzilla and other things that convey horror:

    With a purposeful grimace and a Mongo-like flair
    He throws the spinning disk drives in the air!
    And he picks up a Vax and he throws it back down
    As he wades through the lab making terrible sounds!
    Helpless users with projects due
    Scream "My God!" as he stomps on the tape drives, too!

    Oh, no!  He says Unix runs too slow!  Go, go, DECzilla!
    Oh, yes!  He's gonna bring up VMS!  Go, go, DECzilla!"

* VMS is a trademark of Digital Equipment Corporation
* DECzilla is a trademark of Hollow Chocolate Bunnies of Death, Inc.
        -- Curtis Jackson

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

Предыдущее
От: "Chad Wagner"
Дата:
Сообщение: Re: \prompt for psql
Следующее
От: Mark Dilger
Дата:
Сообщение: Re: patch adding new regexp functions