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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Invent "amadjustmembers" AM method for validating opclass member
Date: 2020-08-01 21:12:59
Message-ID: E1k1yoN-0007g3-Tu@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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@sss.pgh.pa.us

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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Noah Misch 2020-08-01 22:31:40 pgsql: Change XID and mxact limits to warn at 40M and stop at 3M.
Previous Message Tom Lane 2020-08-01 18:16:30 Re: pgsql: Fix some issues with step generation in partition pruning.