internaland to return the pseudo-type
table_am_handler. The argument is a dummy value that simply serves to prevent handler functions from being called directly from SQL commands. The result of the function must be a pointer to a struct of type
TableAmRoutine, which contains everything that the core code needs to know to make use of the table access method. The return value needs to be of server lifetime, which is typically achieved by defining it as a
static constvariable in global scope. The
TableAmRoutinestruct, also called the access method's API struct, defines the behavior of the access method using callbacks. These callbacks are pointers to plain C functions and are not visible or callable at the SQL level. All the callbacks and their behavior is defined in the
TableAmRoutinestructure (with comments inside the struct defining the requirements for callbacks). Most callbacks have wrapper functions, which are documented from the point of view of a user (rather than an implementor) of the table access method. For details, please refer to the
src/include/executor/tuptable.h), which allows code outside the access method to hold references to tuples of the AM, and to access the columns of the tuple.
heap, but if bitmap scan support is desired (it is optional), the block number needs to provide locality.
table access methodcan refer to the existing
heapimplementation present in
src/backend/access/heap/heapam_handler.cfor details of its implementation.