Fix gistkillitems for GiST root page

GiST index killitems feature misbehaves for single-page GiST index,
i.e. one that has only a root page. This is caused by the GiST scan's
curBlkno variable not being initialized for the first-to-scan page,
which is the root page.  Fix this by moving the initializing of
curBlkno into gistScanPage(), where we also set the related curPageLSN
variable.

Commit 377b7ab145 actually added a regression test for this already,
but it merely noted that it's not working and memorized the result
where the items were not killed. Now they are, as the test shows.

This has been broken all along, but since it's just a very minor
performance issue on tiny tables, I didn't bother backpatching it.

Author: Kirill Reshke <[email protected]>
Reviewed-by: Andrey Borodin <[email protected]>
Reviewed-by: Soumya S Murali <[email protected]>
Discussion: 
https://postgr.es/m/CALdSSPgZWX_D8%2BFx4YQqRN5eW5iSx_rJdqQhCfdWTvqKXVfJ4w%40mail.gmail.com
Discussion: 
https://postgr.es/m/lxzj26ga6ippdeunz6kuncectr5gfuugmm2ry22qu6hcx6oid6@lzx3sjsqhmt6

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9c9ddf109bd8d73660ff3fef317f95bc1d7d6cc5

Modified Files
--------------
src/backend/access/gist/gistget.c              | 11 +++++------
src/test/modules/index/expected/killtuples.out |  2 +-
src/test/modules/index/specs/killtuples.spec   |  3 ++-
3 files changed, 8 insertions(+), 8 deletions(-)

Reply via email to