]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Update obsolete row compare preprocessing comments.
authorPeter Geoghegan <pg@bowt.ie>
Wed, 2 Jul 2025 16:36:35 +0000 (12:36 -0400)
committerPeter Geoghegan <pg@bowt.ie>
Wed, 2 Jul 2025 16:36:35 +0000 (12:36 -0400)
Restore nbtree preprocessing comments describing how we mark nbtree row
compare members required to how they were prior to 2016 bugfix commit
a298a1e0.

Oversight in commit bd3f59fd, which made nbtree preprocessing revert to
the original 2006 rules, but neglected to revert these comments.

Backpatch-through: 18

src/backend/access/nbtree/nbtpreprocesskeys.c

index 8eb4bb8410ea220c7add078b6a76c3e239745116..21c519cd108edbefadda3cfb74e9168798e0fe9d 100644 (file)
@@ -752,9 +752,12 @@ _bt_fix_scankey_strategy(ScanKey skey, int16 *indoption)
  *
  * Depending on the operator type, the key may be required for both scan
  * directions or just one.  Also, if the key is a row comparison header,
- * we have to mark its first subsidiary ScanKey as required.  (Subsequent
- * subsidiary ScanKeys are normally for lower-order columns, and thus
- * cannot be required, since they're after the first non-equality scankey.)
+ * we have to mark the appropriate subsidiary ScanKeys as required.  In such
+ * cases, the first subsidiary key is required, but subsequent ones are
+ * required only as long as they correspond to successive index columns and
+ * match the leading column as to sort direction.  Otherwise the row
+ * comparison ordering is different from the index ordering and so we can't
+ * stop the scan on the basis of those lower-order columns.
  *
  * Note: when we set required-key flag bits in a subsidiary scankey, we are
  * scribbling on a data structure belonging to the index AM's caller, not on