pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Consistently enforce tsvector/tsquery maximum lengths.
Date: Thu, 13 Aug 2026 15:20:51 +0000
Message-ID: <E1wuXEg-00000000QS1-3brT@gemulon.postgresql.org> (raw)

Consistently enforce tsvector/tsquery maximum lengths.

Some places rejected individual tokens longer than MAXSTRLEN, while
others rejected ones longer than MAXSTRLEN-1.  The data structure is
perfectly capable of handling MAXSTRLEN, so there's nothing wrong
with using the looser bound.  Moreover, as things stand there is a
dump/reload hazard: some code paths permit construction of a tsvector
or tsquery that would later be rejected by tsvectorin or tsqueryin.
So standardize on using MAXSTRLEN.

Identical remarks apply to MAXSTRPOS (the total data length),
so fix that too.

Back-patch, in hopes of avoiding cases where a value acceptable to
one supported release is not acceptable to another.

Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>
Discussion: https://postgr.es/m/CAN4CZFNYQo4zfbRR435uD0vSfuy5y7dnFOXDfKr9zYoL1JnAxA@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1fc1b82b2fe1011565a157bc660eceab60ed7923

Modified Files
--------------
src/backend/tsearch/ts_parse.c      | 4 ++--
src/backend/utils/adt/tsquery.c     | 6 +++---
src/backend/utils/adt/tsvector.c    | 4 ++--
src/backend/utils/adt/tsvector_op.c | 4 ++--
4 files changed, 9 insertions(+), 9 deletions(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1wuXEg-00000000QS1-3brT@gemulon.postgresql.org>
Permalink:  ../E1wuXEg-00000000QS1-3brT@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wuXEg-00000000QS1-3brT@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Consistently enforce tsvector/tsquery maximum lengths.
  In-Reply-To: <E1wuXEg-00000000QS1-3brT@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox