Skip to content

Commit 3da436e

Browse files
Update obsolete nbtree array preprocessing comments.
The array->scan_key references fixed up at the end of preprocessing start out as offsets into the arrayKeyData[] array (the array returned by _bt_preprocess_array_keys at the start of preprocessing that involves array scan keys). Offsets into the arrayKeyData[] array are no longer guaranteed to be valid offsets into our original scan->keyData[] input scan key array, but comments describing the array->scan_key references still talked about scan->keyData[]. Update those comments. Oversight in commit b524974.
1 parent 62ddf7e commit 3da436e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/backend/access/nbtree/nbtutils.c

+4-5
Original file line numberDiff line numberDiff line change
@@ -538,11 +538,10 @@ _bt_preprocess_array_keys(IndexScanDesc scan, int *new_numberOfKeys)
538538
* _bt_preprocess_array_keys_final() -- fix up array scan key references
539539
*
540540
* When _bt_preprocess_array_keys performed initial array preprocessing, it
541-
* set each array's array->scan_key to the array's arrayKeys[] entry offset
542-
* (that also work as references into the original scan->keyData[] array).
541+
* set each array's array->scan_key to its scankey's arrayKeyData[] offset.
543542
* This function handles translation of the scan key references from the
544543
* BTArrayKeyInfo info array, from input scan key references (to the keys in
545-
* scan->keyData[]), into output references (to the keys in so->keyData[]).
544+
* arrayKeyData[]), into output references (to the keys in so->keyData[]).
546545
* Caller's keyDataMap[] array tells us how to perform this remapping.
547546
*
548547
* Also finalizes so->orderProcs[] for the scan. Arrays already have an ORDER
@@ -2974,8 +2973,8 @@ _bt_preprocess_keys(IndexScanDesc scan)
29742973

29752974
/*
29762975
* Now that we've built a temporary mapping from so->keyData[] (output
2977-
* scan keys) to scan->keyData[] (input scan keys), fix array->scan_key
2978-
* references. Also consolidate the so->orderProc[] array such that it
2976+
* scan keys) to arrayKeyData[] (our input scan keys), fix array->scan_key
2977+
* references. Also consolidate the so->orderProcs[] array such that it
29792978
* can be subscripted using so->keyData[]-wise offsets.
29802979
*/
29812980
if (arrayKeyData)

0 commit comments

Comments
 (0)