Re: writing new regexp functions - Mailing list pgsql-hackers

From Jeremy Drake
Subject Re: writing new regexp functions
Date
Msg-id Pine.BSO.4.64.0702011658050.28908@resin.csoft.net
Whole thread Raw
In response to Re: writing new regexp functions  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: writing new regexp functions
List pgsql-hackers
On Thu, 1 Feb 2007, Tom Lane wrote:

> Jeremy Drake <pgsql@jdrake.com> writes:
> > Is there some specific reason that these functions are static,
>
> Yeah: not cluttering the global namespace.

> Is there a reason for not putting your new code itself into regexp.c?

Not really, I just figured it would be cleaner/easier to write it as an
extension.  I also figure that it is unlikely that every regexp function
that anyone could possibly want will be implemented in core in that one
file.  If anyone writes an extension like this, they would need to
duplicate a good amount of code in order to do so, that would make more
difficulty in maintaining the code if it should need to change.  It also
makes developing a new function a lot easier, no need to re-initdb to add
the function, no need to relink the postmaster and restart it every time
the function changes.

Anyway, the particular thing I was writing was a function like
substring(str FROM pattern) which instead of returning just the first
match group, would return an array of text containing all of the match
groups.  I exported the functions in my sandbox, and wrote a module with a
function that does this.

>
>             regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
>                http://archives.postgresql.org
>
>

-- 
Calling J-Man Kink.  Calling J-Man Kink.  Hash missile sighted, target
Los Angeles.  Disregard personal feelings about city and intercept.


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [PATCHES] Full page writes improvement
Next
From: Kate F
Date:
Subject: Function proposal to find the type of a datum