mirror of
https://github.com/postgres/postgres.git
synced 2026-10-23 13:29:09 +03:00
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
This commit is contained in:
@@ -1283,10 +1283,13 @@ tsqueryrecv(PG_FUNCTION_ARGS)
|
||||
* Fill in the left-pointers. Checks that the tree is well-formed as a
|
||||
* side-effect.
|
||||
*/
|
||||
if (size > 0)
|
||||
{
|
||||
findoprnd(item, size, &needcleanup);
|
||||
|
||||
/* Can't have found any QI_VALSTOP nodes */
|
||||
Assert(!needcleanup);
|
||||
}
|
||||
|
||||
/* Copy operands to output struct */
|
||||
for (uint32 i = 0; i < size; i++)
|
||||
|
||||
Reference in New Issue
Block a user