From 3da436ec09ae2f1a0167d4b74b30449f0292f581 Mon Sep 17 00:00:00 2001 From: Peter Geoghegan Date: Tue, 24 Sep 2024 12:58:55 -0400 Subject: [PATCH] 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 b5249741. --- src/backend/access/nbtree/nbtutils.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/backend/access/nbtree/nbtutils.c b/src/backend/access/nbtree/nbtutils.c index b9f8149697..b4ba51357a 100644 --- a/src/backend/access/nbtree/nbtutils.c +++ b/src/backend/access/nbtree/nbtutils.c @@ -538,11 +538,10 @@ _bt_preprocess_array_keys(IndexScanDesc scan, int *new_numberOfKeys) * _bt_preprocess_array_keys_final() -- fix up array scan key references * * When _bt_preprocess_array_keys performed initial array preprocessing, it - * set each array's array->scan_key to the array's arrayKeys[] entry offset - * (that also work as references into the original scan->keyData[] array). + * set each array's array->scan_key to its scankey's arrayKeyData[] offset. * This function handles translation of the scan key references from the * BTArrayKeyInfo info array, from input scan key references (to the keys in - * scan->keyData[]), into output references (to the keys in so->keyData[]). + * arrayKeyData[]), into output references (to the keys in so->keyData[]). * Caller's keyDataMap[] array tells us how to perform this remapping. * * Also finalizes so->orderProcs[] for the scan. Arrays already have an ORDER @@ -2974,8 +2973,8 @@ _bt_preprocess_keys(IndexScanDesc scan) /* * Now that we've built a temporary mapping from so->keyData[] (output - * scan keys) to scan->keyData[] (input scan keys), fix array->scan_key - * references. Also consolidate the so->orderProc[] array such that it + * scan keys) to arrayKeyData[] (our input scan keys), fix array->scan_key + * references. Also consolidate the so->orderProcs[] array such that it * can be subscripted using so->keyData[]-wise offsets. */ if (arrayKeyData) -- 2.11.4.GIT