Re: nbtree's ScalarArrayOp array mark/restore code appears to be buggy

Peter Geoghegan <pg@bowt.ie>

From: Peter Geoghegan <pg@bowt.ie>
To: PostgreSQL Hackers <pgsql-hackers@postgresql.org>, Tom Lane <tgl@sss.pgh.pa.us>
Date: 2023-09-25T17:33:22Z
Lists: pgsql-hackers
On Sat, Sep 23, 2023 at 4:22 PM Peter Geoghegan <pg@bowt.ie> wrote:
> Attached draft patch shows how this could work.
>
> _bt_restore_array_keys() has comments that seem to suppose that
> calling _bt_preprocess_keys is fairly expensive, and something that's
> well worth avoiding. But...is it, really? I wonder if we'd be better
> off just biting the bullet and always calling _bt_preprocess_keys
> here.

My current plan is to commit something close to my original patch on
Wednesday or Thursday. My proposed fix is minimally invasive (it still
allows _bt_restore_array_keys to avoid most calls to
_bt_preprocess_keys), so I don't see any reason to delay acting here.

-- 
Peter Geoghegan



Commits

  1. Fix btmarkpos/btrestrpos array key wraparound bug.

  2. Fix btmarkpos/btrestrpos to handle array keys.