Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-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

pgsql-hackers by date

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

pgsql-patches by date

Next:From: Koichi SuzukiDate: 2007-02-02 02:05:52
Subject: Re: [HACKERS] Full page writes improvement
Previous:From: Tom LaneDate: 2007-02-02 01:03:27
Subject: Re: [HACKERS] Full page writes improvement

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group