Commit 56a8296
committed
Fix parsing of ignored operators in websearch_to_tsquery().
The manual says clearly that punctuation in the input of
websearch_to_tsquery() is ignored, except for the special cases
of dashes and quotes. However, this failed for cases like
"(foo bar) or something", or in general an ISOPERATOR character
in front of the "or". We'd switch back to WAITOPERAND state,
then ignore the operator character while remaining in that state,
and then reach the "or" in WAITOPERAND state which (intentionally)
makes us treat it as data.
The fix is simple enough: if we see an ISOPERATOR character while in
WAITOPERATOR state, we have to skip it while staying in that state.
(We don't need to worry about other punctuation characters: those will
be consumed as though they were words, but then rejected by lexizing.)
In v14 and up (since commit eb08605) we can simplify the code a bit
more too, because there is no longer a reason for the WAITOPERAND
state to distinguish between quoted and unquoted operands.
Per bug #18479 from Manos Emmanouilidis. Back-patch to all supported
branches.
Discussion: https://postgr.es/m/18479-d9b46e2fc242c33e@postgresql.org1 parent d872e1b commit 56a8296
File tree
3 files changed
+19
-13
lines changed- src
- backend/utils/adt
- test/regress
- expected
- sql
3 files changed
+19
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
439 | 439 | | |
440 | 440 | | |
441 | 441 | | |
442 | | - | |
| 442 | + | |
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
| |||
476 | 476 | | |
477 | 477 | | |
478 | 478 | | |
479 | | - | |
| 479 | + | |
480 | 480 | | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | | - | |
| 481 | + | |
488 | 482 | | |
489 | 483 | | |
490 | 484 | | |
491 | 485 | | |
492 | 486 | | |
493 | 487 | | |
494 | 488 | | |
495 | | - | |
| 489 | + | |
496 | 490 | | |
497 | | - | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
498 | 494 | | |
499 | 495 | | |
500 | 496 | | |
501 | | - | |
502 | | - | |
| 497 | + | |
503 | 498 | | |
| 499 | + | |
504 | 500 | | |
505 | 501 | | |
506 | 502 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2676 | 2676 | | |
2677 | 2677 | | |
2678 | 2678 | | |
| 2679 | + | |
2679 | 2680 | | |
2680 | 2681 | | |
2681 | 2682 | | |
2682 | 2683 | | |
2683 | 2684 | | |
2684 | 2685 | | |
| 2686 | + | |
| 2687 | + | |
| 2688 | + | |
| 2689 | + | |
| 2690 | + | |
| 2691 | + | |
2685 | 2692 | | |
2686 | 2693 | | |
2687 | 2694 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
818 | 818 | | |
819 | 819 | | |
820 | 820 | | |
| 821 | + | |
| 822 | + | |
821 | 823 | | |
| 824 | + | |
822 | 825 | | |
823 | 826 | | |
824 | 827 | | |
| |||
0 commit comments