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
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/45fc51fcbf4534ea2f6f85e36f8155dbd5ba9851

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

Reply via email to