We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parentdfb1e9b commit6c2744fCopy full SHA for 6c2744f
src/backend/tsearch/to_tsany.c
@@ -396,6 +396,7 @@ plainto_tsquery_byid(PG_FUNCTION_ARGS)
396
if (query->size==0)
397
PG_RETURN_TSQUERY(query);
398
399
+/* clean out any stopword placeholders from the tree */
400
res=clean_fakeval(GETQUERY(query),&len);
401
if (!res)
402
{
@@ -405,6 +406,10 @@ plainto_tsquery_byid(PG_FUNCTION_ARGS)
405
406
}
407
memcpy((void*)GETQUERY(query), (void*)res,len*sizeof(QueryItem));
408
409
+/*
410
+ * Removing the stopword placeholders might've resulted in fewer
411
+ * QueryItems. If so, move the operands up accordingly.
412
+ */
413
if (len!=query->size)
414
415
char*oldoperand=GETOPERAND(query);
@@ -413,7 +418,7 @@ plainto_tsquery_byid(PG_FUNCTION_ARGS)
418
Assert(len<query->size);
419
420
query->size=len;
416
-memcpy((void*)GETOPERAND(query),oldoperand,lenoperand);
421
+memmove((void*)GETOPERAND(query),oldoperand,lenoperand);
417
422
SET_VARSIZE(query,COMPUTESIZE(len,lenoperand));
423
424