Re: BUG #19958: jsonpath: a word directly followed by a /* comment */ is silently dropped, so strict becomes lax

From: Ishjaap Singh <ishjaap(dot)singh07(at)gmail(dot)com>
To: james(dot)moore(at)g5labs(dot)ai, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19958: jsonpath: a word directly followed by a /* comment */ is silently dropped, so strict becomes lax
Date: 2026-12-02 07:32:22
Message-ID: CA+Y2Bmd8pvy+tMVaV0WuZ_sa9VJYse5Ts56vfzWjZa+Fcan-Lw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi James,

Thanks for the report. I can reproduce it on every supported branch
(15 to 19) and on master. The rule goes back to the original jsonpath
commit 72b6460336e.

Your reading of the scanner is right. The <xnq>\/\* rule starts the
comment without returning the word, and flex picks it over the
<xnq>({special}|\") rule because "/*" is the longer match.

The attached patch removes that rule. The {special} rule then treats
"/" like any other delimiter: it returns the word, puts the "/" back,
and "/*" is scanned as a comment from the initial state. Keeping the
<xnq>\/\* rule and adding the missing return also works, but then the
error for 'abc/**/1' points at "/*" instead of the end of input.

It adds seven regression tests. Six fail without the fix; the lax one
is a control. make check passes.

The patch is against master and applies to 18 and 19. I also tested
versions for 15 to 17, which use the older scanner, and make check
passes on all five branches. I can post the backpatches if that helps.

Regards,
Ishjaap Singh

Attachment Content-Type Size
v1-0001-Don-t-drop-a-jsonpath-word-directly-followed-by-a.patch application/octet-stream 3.3 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Zejiang Zhang 2026-12-02 08:19:54 Re: BUG #19958: jsonpath: a word directly followed by a /* comment */ is silently dropped, so strict becomes lax
Previous Message Rahila Syed 2026-12-02 05:50:46 Re: BUG #19833: ALTER TABLE that rebuilds an extended statistics object silently drops its SET STATISTICS target (st