Add a new column to pg_am to specify whether an index AM supports backward
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 17 Oct 2008 22:10:30 +0000 (22:10 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 17 Oct 2008 22:10:30 +0000 (22:10 +0000)
commit4fb1652eb41857f9c898dcf650fd3683c28595a8
treefacb39d43cf4e9bf9864176763b8b7d3c08b0593
parente23b42dba457ecc9d6722164689101fb7e6c8767
Add a new column to pg_am to specify whether an index AM supports backward
scanning; GiST and GIN do not, and it seems like too much trouble to make
them do so.  By teaching ExecSupportsBackwardScan() about this restriction,
we ensure that the planner will protect a scroll cursor from the problem
by adding a Materialize node.

In passing, fix another longstanding bug in the same area: backwards scan of
a plan with set-returning functions in the targetlist did not work either,
since the TupFromTlist expansion code pays no attention to direction (and
has no way to run a SRF backwards anyway).  Again the fix is to make
ExecSupportsBackwardScan check this restriction.

Also adjust the index AM API specification to note that mark/restore support
is unnecessary if the AM can't produce ordered output.
doc/src/sgml/catalogs.sgml
doc/src/sgml/indexam.sgml
src/backend/executor/execAmi.c
src/include/catalog/catversion.h
src/include/catalog/pg_am.h