order to work. For example, the B-tree
index method must be able to compare two keys and determine whether one
is greater than, equal to, or less than the other. Similarly, the
hash index method must be able to compute hash codes for key values.
These operations do not correspond to operators used in qualifications in
SQL commands; they are administrative routines used by
the index methods, internally.
</para>
<para>
Just as with strategies, the operator class identifies which specific
functions should play each of these roles for a given data type and
semantic interpretation. The index method defines the set
of functions it needs, and the operator class identifies the correct
functions to use by assigning them to the <quote>support function numbers</quote>
specified by the index method.
</para>
<para>
Additionally, some opclasses allow users to specify parameters which
control their behavior. Each builtin index access method has an optional
<function>options</function> support function, which defines a set of
opclass-specific parameters.
</para>
<para>
B-trees require a comparison support function,
and allow four additional support functions to be
supplied at the operator class author's option, as shown in <xref
linkend="xindex-btree-support-table"/>.
The requirements for these support functions are explained further in
<xref linkend="btree-support-funcs"/>.
</para>
<table tocentry="1" id="xindex-btree-support-table">
<title>B-Tree Support Functions</title>
<tgroup cols="2">
<colspec colname="col1" colwidth="3*"/>
<colspec colname="col2" colwidth="1*"/>
<thead>
<row>
<entry>Function</entry>
<entry>Support Number</entry>
</row>
</thead>
<tbody>
<row>
<entry>
Compare two keys and return an integer less than zero, zero, or
greater than zero, indicating whether the first key is less than,
equal to, or greater than the second
</entry>
<entry>1</entry>
</row>
<row>
<entry>
Return the addresses of C-callable sort support function(s)
(optional)
</entry>
<entry>2</entry>
</row>
<row>
<entry>
Compare a test value to a base value plus/minus an offset, and return
true or false according to the comparison result (optional)
</entry>
<entry>3</entry>
</row>
<row>
<entry>
Determine if it is safe for indexes that use the operator
class to apply the btree deduplication optimization (optional)
</entry>
<entry>4</entry>
</row>
<row>
<entry>
Define options that are specific to this operator class
(optional)
</entry>
<entry>5</entry>
</row>
<row>
<entry>
Return the addresses of C-callable skip support function(s)
(optional)
</entry>
<entry>6</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Hash indexes require one support function, and allow two additional ones to
be supplied at the operator class author's option, as shown in <xref
linkend="xindex-hash-support-table"/>.
</para>
<table tocentry="1" id="xindex-hash-support-table">
<title>Hash Support Functions</title>
<tgroup cols="2">
<colspec colname="col1" colwidth="3*"/>
<colspec colname="col2" colwidth="1*"/>
<thead>
<row>
<entry>Function</entry>
<entry>Support Number</entry>
</row>
</thead>
<tbody>
<row>
<entry>Compute the 32-bit hash value for a key</entry>
<entry>1</entry>
</row>
<row>
<entry>
Compute the 64-bit hash value for a key given a 64-bit salt; if
the salt is 0, the low 32 bits of the result must match the value
that would have been computed by function 1
(optional)
</entry>