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

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: zhq651(at)126(dot)com
Subject: BUG #15595: matchctx->npatterns is always 1 no matter pattern have 0 or 1 subexpression
Date: 2019-01-17 01:30:03
Message-ID: 15595-e6317afee476db49@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 15595
Logged by: Damion
Email address: zhq651(at)126(dot)com
PostgreSQL version: 11.1
Operating system: linux
Description:

Hi,
when I use setup_regexp_matches, I found matchctx->npatterns is always 1 no
matter pattern have not or one subexpr subexpression.
so I can't tell whether there is a subexpression. see below:

if orig_str is '221133' & pattern is '11'
(gdb) p nth_subexpr
$23 = 1
(gdb) p matchctx->npatterns
$24 = 1

if orig_str is '221133' & pattern is '(11)'
(gdb) p nth_subexpr
$25 = 1
(gdb) p matchctx->npatterns
$26 = 1

if pattern is '((1)1)' or '((11))' (2 subexpression or more), I can kwown
how many subexpression by matchctx->npatterns .
postgres=# SELECT regexp_substr('221133', '((1)1)', 1, 1, 'i', 1);
(gdb) p matchctx->npatterns
$27 = 2
(gdb) p nth_subexpr
$28 = 1

Thanks.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next 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
Previous Message Alexander Lakhin 2019-01-16 20:04:59 Re: BUG #15594: Unstable tests in contrib/test_decoding/output_iso/