pgsql: Add equalimage B-Tree support functions.

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add equalimage B-Tree support functions.
Date: 2020-02-26 19:29:56
Message-ID: E1j72NY-0002gi-2B@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/612a1ab76724aa1514b6509269342649f8cab375

Modified Files
--------------
doc/src/sgml/btree.sgml | 96 ++++++++++++++++++++++++++++-
doc/src/sgml/ref/alter_opfamily.sgml | 7 ++-
doc/src/sgml/ref/create_opclass.sgml | 14 +++--
doc/src/sgml/xindex.sgml | 18 ++++--
src/backend/access/nbtree/nbtutils.c | 73 ++++++++++++++++++++++
src/backend/access/nbtree/nbtvalidate.c | 8 ++-
src/backend/commands/opclasscmds.c | 30 ++++++++-
src/backend/utils/adt/datum.c | 26 ++++++++
src/backend/utils/adt/varlena.c | 20 ++++++
src/bin/pg_dump/t/002_pg_dump.pl | 12 ++--
src/include/access/nbtree.h | 8 ++-
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_amproc.dat | 60 ++++++++++++++++++
src/include/catalog/pg_proc.dat | 6 ++
src/test/regress/expected/alter_generic.out | 8 ++-
src/test/regress/expected/opr_sanity.out | 36 +++++++++++
src/test/regress/sql/alter_generic.sql | 3 +
src/test/regress/sql/opr_sanity.sql | 18 ++++++
18 files changed, 418 insertions(+), 27 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Geoghegan 2020-02-26 21:06:17 pgsql: Add deduplication to nbtree.
Previous Message Magnus Hagander 2020-02-26 09:06:40 pgsql: Include error code in message from pg_upgrade