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

From Tom Lane
Subject Re: BUG #15595: matchctx->npatterns is always 1 no matter pattern have 0 or 1 subexpression
Date
Msg-id 3697.1547692137@sss.pgh.pa.us
Whole thread Raw
In response to BUG #15595: matchctx->npatterns is always 1 no matter pattern have 0or 1 subexpression  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
=?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


pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #15596: Folders created with wrong permissions when installing anextension with a non-default umask
Next
From: Andrew Gierth
Date:
Subject: Re: BUG #15595: matchctx->npatterns is always 1 no matter pattern have 0 or 1 subexpression