summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2008-10-17 22:10:30 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2008-10-17 22:10:30 +0000
commite4fb8ff06a8aa1b4c073c46f63b7effd5885e327 (patch)
tree870a38b1b82a5d72dd4bc63ec1270593f0d33936 /doc/src
parent2a64931c4bc76c5e800c3fb1eb5a18dc256899c9 (diff)
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.
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/catalogs.sgml9
-rw-r--r--doc/src/sgml/indexam.sgml19
2 files changed, 20 insertions, 8 deletions
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index ae6dfbd8a55..a68799334ad 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.178 2008/10/06 13:59:37 tgl Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.179 2008/10/17 22:10:29 tgl Exp $ -->
<!--
Documentation of the system catalogs, directed toward PostgreSQL developers
-->
@@ -402,6 +402,13 @@
</row>
<row>
+ <entry><structfield>amcanbackward</structfield></entry>
+ <entry><type>bool</type></entry>
+ <entry></entry>
+ <entry>Does the access method support backward scanning?</entry>
+ </row>
+
+ <row>
<entry><structfield>amcanunique</structfield></entry>
<entry><type>bool</type></entry>
<entry></entry>
diff --git a/doc/src/sgml/indexam.sgml b/doc/src/sgml/indexam.sgml
index 393ccfa2dd1..db16c1d4ee5 100644
--- a/doc/src/sgml/indexam.sgml
+++ b/doc/src/sgml/indexam.sgml
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/indexam.sgml,v 2.27 2008/08/14 18:47:58 tgl Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/indexam.sgml,v 2.28 2008/10/17 22:10:29 tgl Exp $ -->
<chapter id="indexam">
<title>Index Access Method Interface Definition</title>
@@ -474,15 +474,20 @@ amrestrpos (IndexScanDesc scan);
normally would. (This will only occur for access
methods that advertise they support ordered scans.) After the
first call, <function>amgettuple</> must be prepared to advance the scan in
- either direction from the most recently returned entry.
+ either direction from the most recently returned entry. (But if
+ <structname>pg_am</>.<structfield>amcanbackward</> is false, all subsequent
+ calls will have the same direction as the first one.)
</para>
<para>
- The access method must support <quote>marking</> a position in a scan
- and later returning to the marked position. The same position might be
- restored multiple times. However, only one position need be remembered
- per scan; a new <function>ammarkpos</> call overrides the previously
- marked position.
+ Access methods that support ordered scans must support <quote>marking</> a
+ position in a scan and later returning to the marked position. The same
+ position might be restored multiple times. However, only one position need
+ be remembered per scan; a new <function>ammarkpos</> call overrides the
+ previously marked position. An access method that does not support
+ ordered scans should still provide mark and restore functions in
+ <structname>pg_am</>, but it is sufficient to have them throw errors if
+ called.
</para>
<para>