Re: BUG #19778: Empty tsquery cannot roundtrip through binary input

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
Cc: roji(at)roji(dot)org, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19778: Empty tsquery cannot roundtrip through binary input
Date: 2026-10-22 17:34:58
Message-ID: 2537307.1792690498@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com> writes:
> On Thu, 22 Oct 2026 at 11:58, PG Bug reporting form
> <noreply(at)postgresql(dot)org> wrote:
>> It appears that an empty binary tsquery cannot be written to PostgreSQL.

> Thanks for the report, I can reproduce this on master too.

Yeah, you can duplicate it without extra moving parts using
binary COPY out and then in.

> tsqueryrecv() calls findoprnd() even for an empty query, and that
> fails with "malformed tsquery: operand not found". The text input
> doesn't have this problem since parse_tsquery() returns early for an
> empty query.
> Attached is a patch that skips findoprnd() when size is 0.

+1, will push.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Ayush Tiwari 2026-10-22 18:55:34 Re: BUG #19786: JSON_TABLE: subquery in PASSING gives "unexpected non-SELECT command in SubLink"
Previous Message Ayush Tiwari 2026-10-22 16:52:37 Re: BUG #19778: Empty tsquery cannot roundtrip through binary input