File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -398,6 +398,7 @@ plainto_tsquery_byid(PG_FUNCTION_ARGS)
398
398
if (query -> size == 0 )
399
399
PG_RETURN_TSQUERY (query );
400
400
401
+ /* clean out any stopword placeholders from the tree */
401
402
res = clean_fakeval (GETQUERY (query ), & len );
402
403
if (!res )
403
404
{
@@ -407,6 +408,10 @@ plainto_tsquery_byid(PG_FUNCTION_ARGS)
407
408
}
408
409
memcpy ((void * ) GETQUERY (query ), (void * ) res , len * sizeof (QueryItem ));
409
410
411
+ /*
412
+ * Removing the stopword placeholders might've resulted in fewer
413
+ * QueryItems. If so, move the operands up accordingly.
414
+ */
410
415
if (len != query -> size )
411
416
{
412
417
char * oldoperand = GETOPERAND (query );
@@ -415,7 +420,7 @@ plainto_tsquery_byid(PG_FUNCTION_ARGS)
415
420
Assert (len < query -> size );
416
421
417
422
query -> size = len ;
418
- memcpy ((void * ) GETOPERAND (query ), oldoperand , lenoperand );
423
+ memmove ((void * ) GETOPERAND (query ), oldoperand , lenoperand );
419
424
SET_VARSIZE (query , COMPUTESIZE (len , lenoperand ));
420
425
}
421
426
You can’t perform that action at this time.
0 commit comments