1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Add equalimage B-Tree support functions.

Invent the concept of a B-Tree equalimage ("equality implies image
equality") support function, registered as support function 4.  This
indicates whether it is safe (or not safe) to apply optimizations that
assume that any two datums considered equal by an operator class's order
method must be interchangeable without any loss of semantic information.
This is static information about an operator class and a collation.

Register an equalimage routine for almost all of the existing B-Tree
opclasses.  We only need two trivial routines for all of the opclasses
that are included with the core distribution.  There is one routine for
opclasses that index non-collatable types (which returns 'true'
unconditionally), plus another routine for collatable types (which
returns 'true' when the collation is a deterministic collation).

This patch is infrastructure for an upcoming patch that adds B-Tree
deduplication.

Author: Peter Geoghegan, Anastasia Lubennikova
Discussion: https://postgr.es/m/CAH2-Wzn3Ee49Gmxb7V1VJ3-AC8fWn-Fr8pfWQebHe8rYRxt5OQ@mail.gmail.com
This commit is contained in:
Peter Geoghegan
2020-02-26 11:28:25 -08:00
parent 4109bb5de4
commit 612a1ab767
18 changed files with 418 additions and 27 deletions

View File

@@ -171,12 +171,14 @@ CREATE OPERATOR CLASS <replaceable class="parameter">name</replaceable> [ DEFAUL
function is intended to support, if different from
the input data type(s) of the function (for B-tree comparison functions
and hash functions)
or the class's data type (for B-tree sort support functions and all
functions in GiST, SP-GiST, GIN and BRIN operator classes). These defaults
are correct, and so <replaceable
class="parameter">op_type</replaceable> need not be specified in
<literal>FUNCTION</literal> clauses, except for the case of a B-tree sort
support function that is meant to support cross-data-type comparisons.
or the class's data type (for B-tree sort support functions,
B-tree equal image functions, and all functions in GiST,
SP-GiST, GIN and BRIN operator classes). These defaults are
correct, and so <replaceable
class="parameter">op_type</replaceable> need not be specified
in <literal>FUNCTION</literal> clauses, except for the case of a
B-tree sort support function that is meant to support
cross-data-type comparisons.
</para>
</listitem>
</varlistentry>