forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitb15e8f7
committed
Fix broken collation-aware searches in SP-GiST text opclass.
spg_text_leaf_consistent() supposed that it should compare onlyMin(querylen, entrylen) bytes of the two strings, and then deal withany excess bytes in one string or the other by assuming the longerstring is greater if the prefixes are equal. Quite aside from thefact that that's just wrong in some locales (e.g., 'ch' is not lessthan 'd' in cs_CZ), it also risked passing incomplete multibytecharacters to strcoll(), with ensuing bad results.Instead, just pass the full strings to varstr_cmp, and let it decidewhat to do about unequal-length strings.Fortunately, this error doesn't imply any index corruption, it's justthat searches might return the wrong set of entries.Per report from Emre Hasegeli, though this is not his patch.Thanks to Peter Geoghegan for review and discussion.This code was born broken, so back-patch to all supported branches.In HEAD, I failed to resist the temptation to do a bit of cosmeticcleanup/pgindent'ing on710d90d, too.Discussion:https://postgr.es/m/CAE2gYzzb6K51VnTq5i5p52z+j9p2duEa-K1T3RrC_GQEynAKEg@mail.gmail.com1 parent22ff2b8 commitb15e8f7
1 file changed
+15
-15
lines changedLines changed: 15 additions & 15 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
626 | 626 |
| |
627 | 627 |
| |
628 | 628 |
| |
629 |
| - | |
630 |
| - | |
| 629 | + | |
| 630 | + | |
631 | 631 |
| |
632 |
| - | |
633 | 632 |
| |
634 |
| - | |
635 |
| - | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
636 | 636 |
| |
637 |
| - | |
| 637 | + | |
638 | 638 |
| |
639 | 639 |
| |
640 | 640 |
| |
| |||
648 | 648 |
| |
649 | 649 |
| |
650 | 650 |
| |
651 |
| - | |
652 |
| - | |
| 651 | + | |
| 652 | + | |
653 | 653 |
| |
654 | 654 |
| |
655 | 655 |
| |
656 | 656 |
| |
657 | 657 |
| |
658 | 658 |
| |
659 |
| - | |
660 | 659 |
| |
661 |
| - | |
662 |
| - | |
663 |
| - | |
664 |
| - | |
665 |
| - | |
666 |
| - | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
667 | 667 |
| |
668 | 668 |
| |
669 | 669 |
| |
|
0 commit comments
Comments
(0)