diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2020-08-01 17:12:47 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2020-08-01 17:12:47 -0400 |
commit | 9f9682783bea74bf8d93cac4f7dd65fa677f5dc7 (patch) | |
tree | 5328d55da702250d9da41c3a3b83ce7c1a99d8f1 /src/include/access/amvalidate.h | |
parent | e2b37d9e7cabc90633c4bd822e1bcfdd1bda44c4 (diff) | |
download | postgresql-9f9682783bea74bf8d93cac4f7dd65fa677f5dc7.tar.gz postgresql-9f9682783bea74bf8d93cac4f7dd65fa677f5dc7.zip |
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
Diffstat (limited to 'src/include/access/amvalidate.h')
-rw-r--r-- | src/include/access/amvalidate.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/include/access/amvalidate.h b/src/include/access/amvalidate.h index f3a0e52d84e..149fc75f856 100644 --- a/src/include/access/amvalidate.h +++ b/src/include/access/amvalidate.h @@ -1,7 +1,8 @@ /*------------------------------------------------------------------------- * * amvalidate.h - * Support routines for index access methods' amvalidate functions. + * Support routines for index access methods' amvalidate and + * amadjustmembers functions. * * Copyright (c) 2016-2020, PostgreSQL Global Development Group * @@ -32,6 +33,8 @@ extern bool check_amproc_signature(Oid funcid, Oid restype, bool exact, extern bool check_amoptsproc_signature(Oid funcid); extern bool check_amop_signature(Oid opno, Oid restype, Oid lefttype, Oid righttype); +extern Oid opclass_for_family_datatype(Oid amoid, Oid opfamilyoid, + Oid datatypeoid); extern bool opfamily_can_sort_type(Oid opfamilyoid, Oid datatypeoid); #endif /* AMVALIDATE_H */ |