Re: BUG #19748: tsvectorrecv accepts duplicate lexemes and position 0 that tsvectorin rejects

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: kehan5800(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19748: tsvectorrecv accepts duplicate lexemes and position 0 that tsvectorin rejects
Date: 2026-10-06 21:27:47
Message-ID: 1568030.1791322067@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I wrote:
> PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
>> Two checks are still missing relative to tsvectorin():
>> 1. Duplicate lexemes are not merged.

> So my proposal is to just throw an error if the lexeme sequence isn't
> strictly increasing, as it already does for positions. That is
> probably not something to back-patch, but this issue is surely not
> important enough to worry about back-patching.

>> 2. ... a leading position 0 is accepted.

> Agreed, that's an oversight.

Here's what that would look like.

regards, tom lane

Attachment Content-Type Size
v1-0001-Tighten-data-validity-checks-in-tsvectorrecv.patch text/x-diff 3.5 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message shihao zhong 2026-10-07 00:53:52 Re: BUG #19732: first_value/last_value/nth_value return NULL with EXCLUDE TIES when the current row is outside its f
Previous Message Zsolt Parragi 2026-10-06 21:24:08 Re: autovacuum: automatically propagate updated parameters