From: Tom Lane <tgl@sss.pgh.pa.us>
To: zhq651@126.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15595: matchctx->npatterns is always 1 no matter pattern have 0 or 1 subexpression
Date: Wed, 16 Jan 2019 21:28:57 -0500
Message-ID: <3697.1547692137@sss.pgh.pa.us> (raw)
In-Reply-To: <15595-e6317afee476db49@postgresql.org>
References: <15595-e6317afee476db49@postgresql.org>
=?utf-8?q?PG_Bug_reporting_form?= <noreply@postgresql.org> writes:
> when I use setup_regexp_matches, I found matchctx->npatterns is always 1 no
> matter pattern have not or one subexpr subexpression.
It seems unlikely that this is a Postgres bug.
Just looking at the code in setup_regexp_matches, I wonder whether you
are passing use_subpatterns = true or not:
/* do we want to remember subpatterns? */
if (use_subpatterns && cpattern->re_nsub > 0)
{
matchctx->npatterns = cpattern->re_nsub;
pmatch_len = cpattern->re_nsub + 1;
}
else
{
use_subpatterns = false;
matchctx->npatterns = 1;
pmatch_len = 1;
}
regards, tom lane
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: tgl@sss.pgh.pa.us, zhq651@126.com
Subject: Re: BUG #15595: matchctx->npatterns is always 1 no matter pattern have 0 or 1 subexpression
In-Reply-To: <3697.1547692137@sss.pgh.pa.us>
References: <15595-e6317afee476db49@postgresql.org> <3697.1547692137@sss.pgh.pa.us>
* 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