additional expectation is that <function>in_range</function>
functions should, if practical, avoid throwing an error if
<replaceable>base</replaceable> <literal>+</literal>
<replaceable>offset</replaceable> or
<replaceable>base</replaceable> <literal>-</literal>
<replaceable>offset</replaceable> would overflow. The correct
comparison result can be determined even if that value would be
out of the data type's range. Note that if the data type
includes concepts such as <quote>infinity</quote> or
<quote>NaN</quote>, extra care may be needed to ensure that
<function>in_range</function>'s results agree with the normal
sort order of the operator family.
</para>
<para>
The results of the <function>in_range</function> function must be
consistent with the sort ordering imposed by the operator family.
To be precise, given any fixed values of
<replaceable>offset</replaceable> and
<replaceable>sub</replaceable>, then:
<itemizedlist>
<listitem>
<para>
If <function>in_range</function> with
<replaceable>less</replaceable> = true is true for some
<replaceable>val1</replaceable> and
<replaceable>base</replaceable>, it must be true for every
<replaceable>val2</replaceable> <literal><=</literal>
<replaceable>val1</replaceable> with the same
<replaceable>base</replaceable>.
</para>
</listitem>
<listitem>
<para>
If <function>in_range</function> with
<replaceable>less</replaceable> = true is false for some
<replaceable>val1</replaceable> and
<replaceable>base</replaceable>, it must be false for every
<replaceable>val2</replaceable> <literal>>=</literal>
<replaceable>val1</replaceable> with the same
<replaceable>base</replaceable>.
</para>
</listitem>
<listitem>
<para>
If <function>in_range</function> with
<replaceable>less</replaceable> = true is true for some
<replaceable>val</replaceable> and
<replaceable>base1</replaceable>, it must be true for every
<replaceable>base2</replaceable> <literal>>=</literal>
<replaceable>base1</replaceable> with the same
<replaceable>val</replaceable>.
</para>
</listitem>
<listitem>
<para>
If <function>in_range</function> with
<replaceable>less</replaceable> = true is false for some
<replaceable>val</replaceable> and
<replaceable>base1</replaceable>, it must be false for every
<replaceable>base2</replaceable> <literal><=</literal>
<replaceable>base1</replaceable> with the same
<replaceable>val</replaceable>.
</para>
</listitem>
</itemizedlist>
Analogous statements with inverted conditions hold when
<replaceable>less</replaceable> = false.
</para>
<para>
If the type being ordered (<type>type1</type>) is collatable, the
appropriate collation OID will be passed to the
<function>in_range</function> function, using the standard
PG_GET_COLLATION() mechanism.
</para>
<para>
<function>in_range</function> functions need not handle NULL
inputs, and typically will be marked strict.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><function>equalimage</function></term>
<listitem>
<para>
Optionally, a btree operator family may provide
<function>equalimage</function> (<quote>equality implies image
equality</quote>) support functions, registered under support
function number 4. These functions allow the core code to
determine when it is safe to apply the btree deduplication
optimization. Currently, <function>equalimage</function>
functions are only called when building or rebuilding an index.
</para>
<para>
An <function>equalimage</function> function must have the