Re: writing new regexp functions

From: Jeremy Drake <pgsql(at)jdrake(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: writing new regexp functions
Date: 2007-02-02 01:11:30
Message-ID: Pine.BSO.4.64.0702011658050.28908@resin.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On Thu, 1 Feb 2007, Tom Lane wrote:

> Jeremy Drake <pgsql(at)jdrake(dot)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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chander Ganesan 2007-02-02 01:44:12 Re: About PostgreSQL certification
Previous Message Tom Lane 2007-02-02 01:03:27 Re: [HACKERS] Full page writes improvement

Browse pgsql-patches by date

  From Date Subject
Next Message Koichi Suzuki 2007-02-02 02:05:52 Re: [HACKERS] Full page writes improvement
Previous Message Tom Lane 2007-02-02 01:03:27 Re: [HACKERS] Full page writes improvement