forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit9e85b20
committed
Avoid nbtree index scan SAOP scanBehind confusion.
Consistently reset so->scanBehind at the beginning of nbtree arrayadvancement, even during sktrig_required=false calls (calls where arrayadvancement is triggered by an unsatisfied non-required array scan key).Otherwise, it's possible for queries to fail to return all relevanttuples to the scan given a low-order required scan key that waspreviously deemed "satisfied" by a truncated high key attribute value.This only happened at the point where a later non-required array scankey needed to be "advanced" once on the next leaf page (that is, oncethe right sibling of the truncated high key page was reached).The underlying issue was that later code within _bt_advance_array_keysassumed that the so->scanBehind flag must have been set using thecurrent page's high key (not the previous page's high key). Any latersuccessful recheck call to _bt_check_compare would therefore spuriouslybe prevented from making _bt_advance_array_keys return true, based onthe faulty belief that the truncated attribute must be from the scan'scurrent tuple (i.e. the non-pivot tuple at the start of the next page)._bt_advance_array_keys would return false for the tuple, ultimatelyresulting in _bt_checkkeys failing to return a matching tuple.Oversight in commit5bf748b, which enhanced nbtree ScalarArrayOpexecution.Author: Peter Geoghegan <pg@bowt.ie>Discussion:https://postgr.es/m/CAH2-WzkJKncfqyAUTeuB5GgRhT1vhsWO2q11dbZNqKmvjopP_g@mail.gmail.comBackpatch: 17-, where commit5bf748b first appears.1 parent7b8d45d commit9e85b20
1 file changed
+6
-2
lines changedLines changed: 6 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1800 | 1800 |
| |
1801 | 1801 |
| |
1802 | 1802 |
| |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
1803 | 1809 |
| |
1804 | 1810 |
| |
1805 | 1811 |
| |
| |||
1808 | 1814 |
| |
1809 | 1815 |
| |
1810 | 1816 |
| |
1811 |
| - | |
1812 |
| - | |
1813 | 1817 |
| |
1814 | 1818 |
| |
1815 | 1819 |
| |
|
0 commit comments
Comments
(0)