Fix nbtree unsatisfiable row compare assertion failure.

An assertion within nbtree preprocessing's _bt_mark_scankey_required
function expects the first member key of a row compare to have the same
strategy as its header key, which its caller passes.  But the first row
member key won't necessarily have been commuted in cases where the row
compare is unsatisfiable due to its first member key having a NULL
argument.  This led to spurious assertion failures in the single key
fast path call to _bt_mark_scankey_required.

To fix, always commute the row members, even when the row compare is
unsatisfiable.  That way the header and its members will always agree on
strategy.

Oversight in commit ec986020, which improved nbtree's unsatisfiable
RowCompare detection.

Author: Peter Geoghegan <[email protected]>
Backpatch-through: 18

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4732a5c53bd858ed057d52286fb6105385baa2a6

Modified Files
--------------
src/backend/access/nbtree/nbtpreprocesskeys.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)

Reply via email to