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

Re: writing new regexp functions

From: David Fetter <david(at)fetter(dot)org>
To: Jeremy Drake <pgsql(at)jdrake(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>,PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: writing new regexp functions
Date: 2007-02-02 05:11:42
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-patches
On Thu, Feb 01, 2007 at 05:11:30PM -0800, Jeremy Drake wrote:
> 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.

That'd be great!  People who use dynamic languages like Perl would
feel much more at home having access to all the matches.  While you're
at it, could you could make pre-match and post-match (optionally--I
know it's expensive) available?

David Fetter <david(at)fetter(dot)org>
phone: +1 415 235 3778        AIM: dfetter666
                              Skype: davidfetter

Remember to vote!

In response to


pgsql-hackers by date

Next:From: Jim NasbyDate: 2007-02-02 05:20:36
Subject: Re: Logging Lock Waits
Previous:From: Jim NasbyDate: 2007-02-02 05:10:05
Subject: Re: RI checks during UPDATEs

pgsql-patches by date

Next:From: Bruce MomjianDate: 2007-02-02 05:43:04
Subject: Re: column ordering, was Re: [PATCHES] Enums patch v2
Previous:From: Bruce MomjianDate: 2007-02-02 03:50:12
Subject: Re: Enums patch v2

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