Re: BUG #15595: matchctx->npatterns is always 1 no matter pattern have 0 or 1 subexpression

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: zhq651(at)126(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15595: matchctx->npatterns is always 1 no matter pattern have 0 or 1 subexpression
Date: 2019-01-17 02:28:57
Message-ID: 3697.1547692137@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

=?utf-8?q?PG_Bug_reporting_form?= <noreply(at)postgresql(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrew Gierth 2019-01-17 02:31:56 Re: BUG #15595: matchctx->npatterns is always 1 no matter pattern have 0 or 1 subexpression
Previous Message PG Bug reporting form 2019-01-17 01:48:30 BUG #15596: Folders created with wrong permissions when installing an extension with a non-default umask