Re: Patch: regexp_matches variant returning an array of matching positions - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Patch: regexp_matches variant returning an array of matching positions
Date
Msg-id 20140128211911.GX10723@eldon.alvh.no-ip.org
Whole thread Raw
In response to Patch: regexp_matches variant returning an array of matching positions  (Björn Harrtell <bjorn.harrtell@gmail.com>)
Responses Re: Patch: regexp_matches variant returning an array of matching positions  (David Johnston <polobo@yahoo.com>)
List pgsql-hackers
Björn Harrtell wrote:
> I've written a variant of regexp_matches called regexp_matches_positions
> which instead of returning matching substrings will return matching
> positions. I found use of this when processing OCR scanned text and wanted
> to prioritize matches based on their position.

Interesting.  I didn't read the patch but I wonder if it would be of
more general applicability to return more info in a fell swoop a
function returning a set (position, length, text of match), rather than
an array.  So instead of first calling one function to get the match and
then their positions, do it all in one pass.

(See pg_event_trigger_dropped_objects for a simple example of a function
that returns in that fashion.  There are several others but AFAIR that's
the simplest one.)

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Suspicion of a compiler bug in clang: using ternary operator in ereport()
Next
From: Jason Petersen
Date:
Subject: Re: Suspicion of a compiler bug in clang: using ternary operator in ereport()