1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-03 09:13:20 +03:00

Remove obsolete nbtree equality key comments.

_bt_first reliably uses the same equality key (on each index column) for
initial positioning purposes as the one that _bt_checkkeys can use to
end the scan following commit f09816a0.  _bt_first no longer applies its
own independent rules to determine which initial positioning key to use
on each column (for equality and inequality keys alike).  Preprocessing
is now fully in control of determining which keys start and end each
scan, ensuring that _bt_first and _bt_checkkeys have symmetric behavior.

Remove obsolete comments that described why _bt_first was expected to
use at least one of the available required equality keys for initial
positioning purposes.  The rules in this area are now maximally strict
and uniform, so there's no reason to draw attention to equality keys.
Any column with a required equality key cannot have a redundant required
inequality key (nor can it have a redundant required equality key).

Oversight in commit f09816a0, which removed similar comments from
_bt_first, but missed these comments.

Author: Peter Geoghegan <pg@bowt.ie>
Backpatch-through: 18
This commit is contained in:
Peter Geoghegan
2025-11-02 13:34:18 -05:00
parent 645c1e2752
commit 4f08586c7a
2 changed files with 3 additions and 11 deletions

View File

@@ -2246,12 +2246,9 @@ _bt_steppage(IndexScanDesc scan, ScanDirection dir)
*
* _bt_first caller passes us an offnum returned by _bt_binsrch, which might
* be an out of bounds offnum such as "maxoff + 1" in certain corner cases.
* _bt_checkkeys will stop the scan as soon as an equality qual fails (when
* its scan key was marked required), so _bt_first _must_ pass us an offnum
* exactly at the beginning of where equal tuples are to be found. When we're
* passed an offnum past the end of the page, we might still manage to stop
* the scan on this page by calling _bt_checkkeys against the high key. See
* _bt_readpage for full details.
* When we're passed an offnum past the end of the page, we might still manage
* to stop the scan on this page by calling _bt_checkkeys against the high
* key. See _bt_readpage for full details.
*
* On entry, so->currPos must be pinned and locked (so offnum stays valid).
* Parallel scan callers must have seized the scan before calling here.

View File

@@ -2969,11 +2969,6 @@ _bt_check_compare(IndexScanDesc scan, ScanDirection dir,
* Tuple fails this qual. If it's a required qual for the current
* scan direction, then we can conclude no further tuples will
* pass, either.
*
* Note: because we stop the scan as soon as any required equality
* qual fails, it is critical that equality quals be used for the
* initial positioning in _bt_first() when they are available. See
* comments in _bt_first().
*/
if (requiredSameDir)
*continuescan = false;