pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: pgsql-bugs@lists.postgresql.org
To: zhq651@126.com
Subject: Re: BUG #15595: matchctx->npatterns is always 1 no matter pattern have 0 or 1 subexpression
Date: Thu, 17 Jan 2019 02:31:56 +0000
Message-ID: <875zuoja2s.fsf@news-spur.riddles.org.uk> (raw)
In-Reply-To: <15595-e6317afee476db49@postgresql.org>
References: <15595-e6317afee476db49@postgresql.org>

>>>>> "PG" == PG Bug reporting form <noreply@postgresql.org> writes:

 PG> Hi,
 PG> when I use setup_regexp_matches, I found matchctx->npatterns is
 PG> always 1 no matter pattern have not or one subexpr subexpression.

This isn't a bug. setup_regexp_matches is just an internal helper
function for use by regexp_match, regexp_matches, regexp_split_to_table,
and regexp_split_to_array, all of which treat the whole match as the
result if there are no subexpression captures in the regexp. npatterns
is therefore forced to be 1 in that case, so that nmatches * npatterns
is the number of position pairs returned in the match_locs array.

-- 
Andrew (irc:RhodiumToad)




view thread (3+ messages)

Message-ID: <875zuoja2s.fsf@news-spur.riddles.org.uk>
Permalink:  ../875zuoja2s.fsf@news-spur.riddles.org.uk/
Also on:    postgresql.org/message-id/875zuoja2s.fsf@news-spur.riddles.org.uk

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: andrew@tao11.riddles.org.uk, zhq651@126.com
  Subject: Re: BUG #15595: matchctx->npatterns is always 1 no matter pattern have 0 or 1 subexpression
  In-Reply-To: <875zuoja2s.fsf@news-spur.riddles.org.uk>
  References: <15595-e6317afee476db49@postgresql.org> <875zuoja2s.fsf@news-spur.riddles.org.uk>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox