This moves much of the non-heap-specific logic from toast_delete and toast_insert_or_update into a helper functions accessible via a new header, toast_helper.h. Using the functions in this module, a table AM can implement creation and deletion of TOAST table rows with much less code duplication than was possible heretofore. Some table AMs won't want to use the TOAST logic at all, but for those that do this will make that easier.
Patch by me, reviewed and tested by Prabhat Sabu, Thomas Munro, Andres Freund, and Álvaro Herrera.
bd124996ef Create an API for inserting and deleting rows in TOAST tables.
src/backend/access/heap/heaptoast.c | 400 ++++----------------------------
src/backend/access/table/Makefile | 2 +-
src/backend/access/table/toast_helper.c | 331 ++++++++++++++++++++++++++
src/include/access/toast_helper.h | 115 +++++++++
src/tools/pgindent/typedefs.list | 2 +
5 files changed, 493 insertions(+), 357 deletions(-)