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

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: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-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


pgsql-hackers by date

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

pgsql-patches by date

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

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