@@ -190,7 +190,7 @@ typedef struct IndexAmRoutine
190190 implications. The requirements of <structfield>amcanunique</structfield>
191191 are discussed in <xref linkend="index-unique-checks"/>.
192192 The <structfield>amcanmulticol</structfield> flag asserts that the
193- access method supportsmulticolumn indexes, while
193+ access method supportsmulti-key-column indexes, while
194194 <structfield>amoptionalkey</structfield> asserts that it allows scans
195195 where no indexable restriction clause is given for the first index column.
196196 When <structfield>amcanmulticol</structfield> is false,
@@ -226,6 +226,19 @@ typedef struct IndexAmRoutine
226226 conditions.
227227 </para>
228228
229+ <para>
230+ The <structfield>amcaninclude</structfield> flag indicates whether the
231+ access method supports <quote>included</quote> columns, that is it can
232+ store (without processing) additional columns beyond the key column(s).
233+ The requirements of the preceding paragraph apply only to the key
234+ columns. In particular, the combination
235+ of <structfield>amcanmulticol</structfield>=<literal>false</literal>
236+ and <structfield>amcaninclude</structfield>=<literal>true</literal> is
237+ sensible: it means that there can only be one key column, but there can
238+ also be included column(s). Also, included columns must be allowed to be
239+ null, independently of <structfield>amoptionalkey</structfield>.
240+ </para>
241+
229242 </sect1>
230243
231244 <sect1 id="index-functions">
@@ -377,10 +390,13 @@ amcanreturn (Relation indexRelation, int attno);
377390</programlisting>
378391 Check whether the index can support <link
379392 linkend="indexes-index-only-scans"><firstterm>index-only scans</firstterm></link> on
380- the given column, by returning the indexed column values for an index entry
381- in the form of an <structname>IndexTuple</structname>. The attribute number
382- is 1-based, i.e., the first column's attno is 1. Returns true if supported,
383- else false. If the access method does not support index-only scans at all,
393+ the given column, by returning the column's original indexed value.
394+ The attribute number is 1-based, i.e., the first column's attno is 1.
395+ Returns true if supported, else false.
396+ This function should always return true for included columns
397+ (if those are supported), since there's little point in an included
398+ column that can't be retrieved.
399+ If the access method does not support index-only scans at all,
384400 the <structfield>amcanreturn</structfield> field in its <structname>IndexAmRoutine</structname>
385401 struct can be set to NULL.
386402 </para>
@@ -470,7 +486,7 @@ amproperty (Oid index_oid, int attno,
470486 core code does not know how to do that and will return NULL. It may
471487 also be advantageous to implement <literal>AMPROP_RETURNABLE</literal> testing,
472488 if that can be done more cheaply than by opening the index and calling
473- <structfield >amcanreturn</structfield >, which is the core code's default behavior.
489+ <function >amcanreturn</function >, which is the core code's default behavior.
474490 The default behavior should be satisfactory for all other standard
475491 properties.
476492 </para>
@@ -574,10 +590,13 @@ amgettuple (IndexScanDesc scan,
574590
575591 <para>
576592 If the index supports <link linkend="indexes-index-only-scans">index-only
577- scans</link> (i.e., <function>amcanreturn</function> returns true for it),
593+ scans</link> (i.e., <function>amcanreturn</function> returns true for any
594+ of its columns),
578595 then on success the AM must also check <literal>scan->xs_want_itup</literal>,
579596 and if that is true it must return the originally indexed data for the
580- index entry. The data can be returned in the form of an
597+ index entry. Columns for which <function>amcanreturn</function> returns
598+ false can be returned as nulls.
599+ The data can be returned in the form of an
581600 <structname>IndexTuple</structname> pointer stored at <literal>scan->xs_itup</literal>,
582601 with tuple descriptor <literal>scan->xs_itupdesc</literal>; or in the form of
583602 a <structname>HeapTuple</structname> pointer stored at <literal>scan->xs_hitup</literal>,