writing new regexp functions

From: Jeremy Drake <pgsql(at)jdrake(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: writing new regexp functions
Date: 2007-02-01 21:20:18
Message-ID: Pine.BSO.4.64.0702011309240.28908@resin.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

I am wanting to write some new C functions which leverage postgresql's
existing regexp code in an extension module. I notice that the functions
RE_compile_and_cache and RE_compile_and_execute in
src/backend/util/regexp.c contain the code necessary to connect the regexp
code in src/backend/regex with the postgresql string conversion, error
reporting, and memory management infrastructure, as well as providing
caching of regexes which would probably be a win to any regex function in
postgres. It would seem that these functions would be useful to any
C function dealing with regexp matching in postgresql, but they are static
functions, so they cannot be used outside of
src/backend/utils/adt/regexp.c. Since all of the core regexp functions
are in this file, this has been ok, but it is my opinion that these
functions should be made visible and added to a header file so that
extensions can make use of them, because any add-on functions that want to
use the regex code in postgres in some new way would need to basically
duplicate that same code in order to do so.

Is there some specific reason that these functions are static, or would it
be ok to make them non-static and add them to a header (say,
src/include/utils/regexp.h) so that extensions could use them as well? I
could put together a patch for this if desired, or it seems simple enough
that someone could just do it...

--
I can't decide whether to commit suicide or go bowling.
-- Florence Henderson

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2007-02-02 00:28:38 Re: Bitmap index thoughts
Previous Message Richard Troy 2007-02-01 21:05:55 Re: The may/can/might business

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2007-02-02 00:29:46 Re: [pgsql-patches] Fixed shared_preload_libraries on Win32
Previous Message Doug Knight 2007-02-01 20:14:48 Re: pg_standby