Re: patch adding new regexp functions

From: Neil Conway <neilc(at)samurai(dot)com>
To: Jeremy Drake <pgsql(at)jdrake(dot)com>
Cc: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>, David Fetter <david(at)fetter(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: patch adding new regexp functions
Date: 2007-02-10 06:57:46
Message-ID: 1171090666.5454.184.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On Fri, 2007-02-09 at 16:33 -0800, Jeremy Drake wrote:
> Here is a new version of the patch which eliminates the doing_srf stuff.

* C89 require constant-sized stack allocated arrays, so the coding in
perform_regexp_matches() is non-portable.

* I'm not clear about the control flow in regexp_matches() and
regexp_split(). Presumably it's not possible for the call_cntr to
actually exceed max_calls, so the error message in these cases should be
elog(ERROR), not ereport (the former is for "shouldn't happen" bug
scenarios, the latter is for user-facing errors). Can you describe the
logic here (e.g. via comments) a bit more?

* The logic in regexp_split (incremented_offset, first_match, etc.) is
pretty ugly and hard to follow. The "if" condition on line 1037 is
particularly objectionable. Again, ISTM there should be a cleaner way to
do this.

* Try to keep lines to 80 characters or fewer. If the code is wandering
off the right side of the screen all the time, that might be a hint that
it needs simplification.

Attached is a cleaned up version of your patch -- various improvements
throughout, but mostly cosmetic stuff. Do you want to take a look at the
above?

-Neil

Attachment Content-Type Size
regexp-split-matches-documented_new-4.patch text/x-patch 45.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Warren Turkal 2007-02-10 07:20:28 RFC: Temporal Extensions for PostgreSQL
Previous Message Bruce Momjian 2007-02-10 03:45:38 Re: Variable length varlena headers redux

Browse pgsql-patches by date

  From Date Subject
Next Message Jeremy Drake 2007-02-10 08:33:59 Re: patch adding new regexp functions
Previous Message Jeremy Drake 2007-02-10 00:33:38 Re: patch adding new regexp functions