pgsql: Invent "amadjustmembers" AM method for validating opclass member

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

pgsql: Invent "amadjustmembers" AM method for validating opclass member

Tom Lane-2
Invent "amadjustmembers" AM method for validating opclass members.

This allows AM-specific knowledge to be applied during creation of
pg_amop and pg_amproc entries.  Specifically, the AM knows better than
core code which entries to consider as required or optional.  Giving
the latter entries the appropriate sort of dependency allows them to
be dropped without taking out the whole opclass or opfamily; which
is something we'd like to have to correct obsolescent entries in
extensions.

This callback also opens the door to performing AM-specific validity
checks during opclass creation, rather than hoping than an opclass
developer will remember to test with "amvalidate".  For the most part
I've not actually added any such checks yet; that can happen in a
follow-on patch.  (Note that we shouldn't remove any tests from
"amvalidate", as those are still needed to cross-check manually
constructed entries in the initdb data.  So adding tests to
"amadjustmembers" will be somewhat duplicative, but it seems like
a good idea anyway.)

Patch by me, reviewed by Alexander Korotkov, Hamid Akhtar, and
Anastasia Lubennikova.

Discussion: https://postgr.es/m/4578.1565195302@...

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9f9682783bea74bf8d93cac4f7dd65fa677f5dc7

Modified Files
--------------
contrib/bloom/blutils.c                 |   1 +
doc/src/sgml/indexam.sgml               |  44 ++++++++-
src/backend/access/brin/brin.c          |   1 +
src/backend/access/gin/ginutil.c        |   1 +
src/backend/access/gin/ginvalidate.c    |  65 ++++++++++++
src/backend/access/gist/gist.c          |   1 +
src/backend/access/gist/gistvalidate.c  |  69 +++++++++++++
src/backend/access/hash/hash.c          |   1 +
src/backend/access/hash/hashvalidate.c  |  96 ++++++++++++++++++
src/backend/access/index/amvalidate.c   |  39 ++++++--
src/backend/access/nbtree/nbtree.c      |   1 +
src/backend/access/nbtree/nbtvalidate.c |  96 ++++++++++++++++++
src/backend/access/spgist/spgutils.c    |   1 +
src/backend/access/spgist/spgvalidate.c |  66 +++++++++++++
src/backend/commands/opclasscmds.c      | 170 +++++++++++++++++++-------------
src/bin/pg_dump/t/002_pg_dump.pl        |  10 +-
src/include/access/amapi.h              |  43 ++++++++
src/include/access/amvalidate.h         |   5 +-
src/include/access/gin_private.h        |   4 +
src/include/access/gist_private.h       |   4 +
src/include/access/hash.h               |   4 +
src/include/access/nbtree.h             |   4 +
src/include/access/spgist.h             |   4 +
src/include/catalog/opfam_internal.h    |  28 ------
24 files changed, 646 insertions(+), 112 deletions(-)