diff --git a/src/backend/utils/adt/tsquery.c b/src/backend/utils/adt/tsquery.c index 8ccf2a6ef11..f067165083a 100644 --- a/src/backend/utils/adt/tsquery.c +++ b/src/backend/utils/adt/tsquery.c @@ -1343,10 +1343,13 @@ tsqueryrecv(PG_FUNCTION_ARGS) * Fill in the left-pointers. Checks that the tree is well-formed as a * side-effect. */ - findoprnd(item, size, &needcleanup); + if (size > 0) + { + findoprnd(item, size, &needcleanup); - /* Can't have found any QI_VALSTOP nodes */ - Assert(!needcleanup); + /* Can't have found any QI_VALSTOP nodes */ + Assert(!needcleanup); + } /* Copy operands to output struct */ for (i = 0; i < size; i++)