]> granicus.if.org Git - postgresql/commit
Allow index AMs to return either HeapTuple or IndexTuple format during IOS.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 27 Feb 2017 22:20:34 +0000 (17:20 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 27 Feb 2017 22:20:34 +0000 (17:20 -0500)
commit9b88f27cb42fe8ff59ddc75e29c005624b8850a2
tree285c2882206b72c19cc9ac5f7e84a33b663e204c
parent30df93f698d016d086e8961aa6c6076b37ea0ef4
Allow index AMs to return either HeapTuple or IndexTuple format during IOS.

Previously, only IndexTuple format was supported for the output data of
an index-only scan.  This is fine for btree, which is just returning a
verbatim index tuple anyway.  It's not so fine for SP-GiST, which can
return reconstructed data that's much larger than a page.

To fix, extend the index AM API so that index-only scan data can be
returned in either HeapTuple or IndexTuple format.  There's other ways
we could have done it, but this way avoids an API break for index AMs
that aren't concerned with the issue, and it costs little except a couple
more fields in IndexScanDescs.

I changed both GiST and SP-GiST to use the HeapTuple method.  I'm not
very clear on whether GiST can reconstruct data that's too large for an
IndexTuple, but that seems possible, and it's not much of a code change to
fix.

Per a complaint from Vik Fearing.  Reviewed by Jason Li.

Discussion: https://postgr.es/m/49527f79-530d-0bfe-3dad-d183596afa92@2ndquadrant.fr
doc/src/sgml/indexam.sgml
src/backend/access/gist/gistget.c
src/backend/access/gist/gistscan.c
src/backend/access/gist/gistutil.c
src/backend/access/index/genam.c
src/backend/access/index/indexam.c
src/backend/access/spgist/spgscan.c
src/backend/executor/nodeIndexonlyscan.c
src/include/access/gist_private.h
src/include/access/relscan.h
src/include/access/spgist_private.h