summaryrefslogtreecommitdiff
path: root/src/include/access/reloptions.h
diff options
context:
space:
mode:
authorTom Lane2016-01-18 00:36:59 +0000
committerTom Lane2016-01-18 00:36:59 +0000
commit65c5fcd353a859da9e61bfb2b92a99f12937de3b (patch)
tree3d75be487f88d11a27fb0b96809e492838666d72 /src/include/access/reloptions.h
parent8d290c8ec6c182a4df1d089c21fe84c7912f01fe (diff)
Restructure index access method API to hide most of it at the C level.
This patch reduces pg_am to just two columns, a name and a handler function. All the data formerly obtained from pg_am is now provided in a C struct returned by the handler function. This is similar to the designs we've adopted for FDWs and tablesample methods. There are multiple advantages. For one, the index AM's support functions are now simple C functions, making them faster to call and much less error-prone, since the C compiler can now check function signatures. For another, this will make it far more practical to define index access methods in installable extensions. A disadvantage is that SQL-level code can no longer see attributes of index AMs; in particular, some of the crosschecks in the opr_sanity regression test are no longer possible from SQL. We've addressed that by adding a facility for the index AM to perform such checks instead. (Much more could be done in that line, but for now we're content if the amvalidate functions more or less replace what opr_sanity used to do.) We might also want to expose some sort of reporting functionality, but this patch doesn't do that. Alexander Korotkov, reviewed by Petr JelĂ­nek, and rather heavily editorialized on by me.
Diffstat (limited to 'src/include/access/reloptions.h')
-rw-r--r--src/include/access/reloptions.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/include/access/reloptions.h b/src/include/access/reloptions.h
index ca6b519c9e1..469ac677e30 100644
--- a/src/include/access/reloptions.h
+++ b/src/include/access/reloptions.h
@@ -19,6 +19,7 @@
#ifndef RELOPTIONS_H
#define RELOPTIONS_H
+#include "access/amapi.h"
#include "access/htup.h"
#include "access/tupdesc.h"
#include "nodes/pg_list.h"
@@ -258,7 +259,7 @@ extern Datum transformRelOptions(Datum oldOptions, List *defList,
bool ignoreOids, bool isReset);
extern List *untransformRelOptions(Datum options);
extern bytea *extractRelOptions(HeapTuple tuple, TupleDesc tupdesc,
- Oid amoptions);
+ amoptions_function amoptions);
extern relopt_value *parseRelOptions(Datum options, bool validate,
relopt_kind kind, int *numrelopts);
extern void *allocateReloptStruct(Size base, relopt_value *options,
@@ -272,7 +273,7 @@ extern bytea *default_reloptions(Datum reloptions, bool validate,
relopt_kind kind);
extern bytea *heap_reloptions(char relkind, Datum reloptions, bool validate);
extern bytea *view_reloptions(Datum reloptions, bool validate);
-extern bytea *index_reloptions(RegProcedure amoptions, Datum reloptions,
+extern bytea *index_reloptions(amoptions_function amoptions, Datum reloptions,
bool validate);
extern bytea *attribute_reloptions(Datum reloptions, bool validate);
extern bytea *tablespace_reloptions(Datum reloptions, bool validate);