Custom reloptions for table AM

Alexander Korotkov <akorotkov@postgresql.org>

Commit: 9bd99f4c26fe37b8ee2f199aa868a0e2fdba4c43
Author: Alexander Korotkov <akorotkov@postgresql.org>
Date: 2024-04-08T08:23:28Z
Releases: 17.0
Custom reloptions for table AM

Let table AM define custom reloptions for its tables. This allows specifying
AM-specific parameters by the WITH clause when creating a table.

The reloptions, which could be used outside of table AM, are now extracted
into the CommonRdOptions data structure.  These options could be by decision
of table AM directly specified by a user or calculated in some way.

The new test module test_tam_options evaluates the ability to set up custom
reloptions and calculate fields of CommonRdOptions on their base.

The code may use some parts from prior work by Hao Wu.

Discussion: https://postgr.es/m/CAPpHfdurb9ycV8udYqM%3Do0sPS66PJ4RCBM1g-bBpvzUfogY0EA%40mail.gmail.com
Discussion: https://postgr.es/m/AMUA1wBBBxfc3tKRLLdU64rb.1.1683276279979.Hmail.wuhao%40hashdata.cn
Reviewed-by: Reviewed-by: Pavel Borisov, Matthias van de Meent, Jess Davis

Files

PathChange+/−
src/backend/access/common/reloptions.c modified +86 −35
src/backend/access/heap/heapam.c modified +2 −2
src/backend/access/heap/heapam_handler.c modified +13 −0
src/backend/access/heap/heaptoast.c modified +8 −1
src/backend/access/heap/hio.c modified +2 −2
src/backend/access/heap/pruneheap.c modified +2 −2
src/backend/access/heap/rewriteheap.c modified +2 −2
src/backend/access/table/tableamapi.c modified +25 −0
src/backend/access/table/tableam.c modified +1 −1
src/backend/commands/createas.c modified +12 −1
src/backend/commands/tablecmds.c modified +38 −25
src/backend/commands/vacuum.c modified +4 −4
src/backend/postmaster/autovacuum.c modified +7 −5
src/backend/tcop/utility.c modified +25 −3
src/backend/utils/cache/relcache.c modified +70 −3
src/include/access/reloptions.h modified +6 −4
src/include/access/tableam.h modified +50 −0
src/include/utils/rel.h modified +78 −70
src/test/modules/Makefile modified +1 −0
src/test/modules/meson.build modified +1 −0
src/test/modules/test_tam_options/expected/test_tam_options.out added +36 −0
src/test/modules/test_tam_options/.gitignore added +4 −0
src/test/modules/test_tam_options/Makefile added +23 −0
src/test/modules/test_tam_options/meson.build added +33 −0
src/test/modules/test_tam_options/sql/test_tam_options.sql added +25 −0
src/test/modules/test_tam_options/test_tam_options--1.0.sql added +12 −0
src/test/modules/test_tam_options/test_tam_options.c added +66 −0
src/test/modules/test_tam_options/test_tam_options.control added +4 −0
src/tools/pgindent/typedefs.list modified +3 −1

Discussion