writing new regexp functions - Mailing list pgsql-hackers

From Jeremy Drake
Subject writing new regexp functions
Date
Msg-id Pine.BSO.4.64.0702011309240.28908@resin.csoft.net
Whole thread Raw
Responses Re: writing new regexp functions  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: The may/can/might business
Next
From: Bruce Momjian
Date:
Subject: Re: Bitmap index thoughts