Re: BUG #19960: Phrase search matches when it should not: phrase positions wrap at 16383

From: shihao zhong <zhong950419(at)gmail(dot)com>
To: james(dot)moore(at)g5labs(dot)ai, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19960: Phrase search matches when it should not: phrase positions wrap at 16383
Date: 2026-12-05 20:26:11
Message-ID: CAGRkXqTOiMuBP=WnTB84FWJxWvcAKDKp3NhMLDNfJF4pEbET8w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi James,

On Mon, Nov 30, 2026, PG Bug reporting form wrote:
> A phrase query whose left side combines a lexeme at position 16383 with
> an AND/NOT returns true where the same phrase without the AND/NOT,
> correctly, returns false.

I can reproduce this on 15 through 19. A negated left side such as
'(!(b <-> c) & a) <-> d' hits it too. The attached patch clamps the
computed positions to 16383, as tsvector_concat() already does.

Positions at the limit stay approximate after this, the same as in
BUG #17569. I think it should go back to 15.

Thanks,
Shihao

Attachment Content-Type Size
v1-0001-Fix-wraparound-of-phrase-match-positions-in-tsque.patch text/x-patch 3.4 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2026-12-05 20:46:31 Re: BUG #19960: Phrase search matches when it should not: phrase positions wrap at 16383
Previous Message Konstantin Knizhnik 2026-12-05 20:08:12 Re: BUG #19519: REPACK can fail due to missing chunk for toast value