Re: Patch: regexp_matches variant returning an array of matching positions

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: bjorn(at)wololo(dot)org
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Patch: regexp_matches variant returning an array of matching positions
Date: 2014-01-28 21:19:11
Message-ID: 20140128211911.GX10723@eldon.alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jason Petersen 2014-01-28 21:20:38 Re: Suspicion of a compiler bug in clang: using ternary operator in ereport()
Previous Message Christian Kruse 2014-01-28 21:12:01 Re: Suspicion of a compiler bug in clang: using ternary operator in ereport()