Add equalimage B-Tree support functions.
authorPeter Geoghegan <pg@bowt.ie>
Wed, 26 Feb 2020 19:28:25 +0000 (11:28 -0800)
committerPeter Geoghegan <pg@bowt.ie>
Wed, 26 Feb 2020 19:28:25 +0000 (11:28 -0800)
commit612a1ab76724aa1514b6509269342649f8cab375
treedf13756515fd71d6528958f2315123d89d41b817
parent4109bb5de4998b9301ea2ac18c9d6dfb0b4f900b
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
18 files changed:
doc/src/sgml/btree.sgml
doc/src/sgml/ref/alter_opfamily.sgml
doc/src/sgml/ref/create_opclass.sgml
doc/src/sgml/xindex.sgml
src/backend/access/nbtree/nbtutils.c
src/backend/access/nbtree/nbtvalidate.c
src/backend/commands/opclasscmds.c
src/backend/utils/adt/datum.c
src/backend/utils/adt/varlena.c
src/bin/pg_dump/t/002_pg_dump.pl
src/include/access/nbtree.h
src/include/catalog/catversion.h
src/include/catalog/pg_amproc.dat
src/include/catalog/pg_proc.dat
src/test/regress/expected/alter_generic.out
src/test/regress/expected/opr_sanity.out
src/test/regress/sql/alter_generic.sql
src/test/regress/sql/opr_sanity.sql