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: Accept empty tsquery in binary input.
Date: Thu, 22 Oct 2026 17:51:36 +0000
Message-ID: <E1xJwwy-00000000Liz-39Aa@gemulon.postgresql.org> (raw)

Accept empty tsquery in binary input.

tsqueryrecv() calls findoprnd() even when the input has no query
items, so it fails on an empty tsquery, which is legal data.
This breaks, for example, binary COPY of a table containing an
empty tsquery.

Skip the operand walk for an empty query, as parse_tsquery() does.

Bug: #19778
Reported-by: Shay Rojansky <roji@roji.org>
Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19778-1befc1fba593ab1b@postgresql.org
Backpatch-through: 14

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0d0d2a13e8b60f66017836ded0c05b5907921bf0

Modified Files
--------------
src/backend/utils/adt/tsquery.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1xJwwy-00000000Liz-39Aa@gemulon.postgresql.org>
Permalink:  ../E1xJwwy-00000000Liz-39Aa@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xJwwy-00000000Liz-39Aa@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Accept empty tsquery in binary input.
  In-Reply-To: <E1xJwwy-00000000Liz-39Aa@gemulon.postgresql.org>
  References: <E1xJwwy-00000000Liz-39Aa@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