From cce1fa9dbcc134281e6d17f34d2f30cd51345184 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 17 Aug 2026 18:17:51 -0400 Subject: [PATCH] Doc: clean up documentation about text search datatype limits. textsearch.sgml neglected to mention that the MAXSTRPOS total-length limit applies to tsquery as well as tsvector. It also claims that there is a 32K limit on the total number of nodes in a tsquery, which is wrong. (I suspect that QueryOperator.left may once have been int16, which would give rise to such a limit. But it's uint32 now, so you'd hit the 1GB varlena limit well before overflowing that.) While at it, re-order the bullet points into an order that makes more sense, to me anyway. Reported-by: Claude Code (via Noah Misch) Author: Tom Lane Reviewed-by: Chao Li Discussion: https://postgr.es/m/455079.1786897319@sss.pgh.pa.us Backpatch-through: 14 --- doc/src/sgml/textsearch.sgml | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/doc/src/sgml/textsearch.sgml b/doc/src/sgml/textsearch.sgml index c0025827e78..b256e01f613 100644 --- a/doc/src/sgml/textsearch.sgml +++ b/doc/src/sgml/textsearch.sgml @@ -3990,30 +3990,25 @@ Parser: "pg_catalog.default" The length of each lexeme must be less than 2 kilobytes - The length of a tsvector (lexemes + positions) must be - less than 1 megabyte - - - - The number of lexemes must be less than - 264 + No more than 256 positions per lexeme Position values in tsvector must be greater than 0 and no more than 16,383 + + The length of a tsvector's data (lexemes + positions) + must be less than 1 megabyte + + + The length of a tsquery's data (lexemes only) + must be less than 1 megabyte + The match distance in a <N> (FOLLOWED BY) tsquery operator cannot be more than 16,384 - - No more than 256 positions per lexeme - - - The number of nodes (lexemes + operators) in a tsquery - must be less than 32,768 -