- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit9b1f8af
committed
Fix hypothetical bug in heap backward scans
Both heapgettup() and heapgettup_pagemode() incorrectly set the first pageto scan in a backward scan in which the number of pages to scan wasspecified by heap_setscanlimits(). The code incorrectly started the scanat the end of the relation when startBlk was 0, or otherwise atstartBlk - 1, neither of which is correct when only scanning a subset ofpages.The fix here checks if heap_setscanlimits() has changed the number ofpages to scan and if so we set the first page to scan as the final page inthe specified range during backward scans.Proper adjustment of this code was forgotten when heap_setscanlimits() wasadded in7516f52 back in 9.5. However, practice, nowhere in core codeperforms backward scans after having used heap_setscanlimits(), yet, it ispossible an extension uses the heap functions in this way, hencebackpatch.An upcoming patch does use heap_setscanlimits() with backward scans, sothis must be fixed before that can go in.Author: David RowleyDiscussion:https://postgr.es/m/CAApHDvpGc9h0_oVD2CtgBcxCS1N-qDYZSeBRnUh+0CWJA9cMaA@mail.gmail.comBackpatch-through: 9.5, all supported versions1 parentc26a086 commit9b1f8af
1 file changed
+16
-4
lines changedLines changed: 16 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
538 | 538 |
| |
539 | 539 |
| |
540 | 540 |
| |
541 |
| - | |
542 |
| - | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
543 | 549 |
| |
544 | 550 |
| |
545 | 551 |
| |
| |||
812 | 818 |
| |
813 | 819 |
| |
814 | 820 |
| |
815 |
| - | |
816 |
| - | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
817 | 829 |
| |
818 | 830 |
| |
819 | 831 |
| |
|
0 commit comments
Comments
(0)