Re: Expanding regexp_matches flags

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jordan Gigov <coladict(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Expanding regexp_matches flags
Date: 2021-08-12 15:31:55
Message-ID: 4083172.1628782315@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jordan Gigov <coladict(at)gmail(dot)com> writes:
> A recent thread gave me the idea that it would be convenient to have
> another flag for `regexp_matches` to make it return a singular
> two-dimensional array of matches when performing a global match.

> Why? Well, basically you avoid having to aggregate the rows afterwards
> using by wrapping it in a subquery.

> Is there some interest in this?

I'm not really convinced that has any value. The first question you
ought to be answering is whether the recently-pushed regexp function
additions don't already serve whatever use-case you had in mind.

If we do do it, I think it ought to be a different function. "flag"
values that utterly change the meaning of the output sound like a
pretty bad idea. Also, "returns setof text[]" is very different from
"returns text[]". The primary reason we invented regexp_match() a few
years ago was to get away from the ugliness involved in trying to
pretend the former is the latter.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Sabino Mullane 2021-08-12 15:41:15 Re: make MaxBackends available in _PG_init
Previous Message Jordan Gigov 2021-08-12 15:23:41 Expanding regexp_matches flags