The logic used to support a change of access method for a table is similar to changes for tablespace or relation persistence, requiring a table rewrite with an exclusive lock of the relation changed. Table rewrites done in ALTER TABLE already go through the table AM layer when scanning tuples from the old relation and inserting them into the new one, making this implementation straight-forward.
Note that partitioned tables are not supported as these have no access methods defined.
Author: Justin Pryzby, Jeff Davis
b0483263dd Add support for SET ACCESS METHOD in ALTER TABLE
doc/src/sgml/ref/alter_table.sgml | 20 ++++++++++
src/backend/commands/cluster.c | 21 ++++++++---
src/backend/commands/matview.c | 5 ++-
src/backend/commands/tablecmds.c | 66 +++++++++++++++++++++++++++++++--
src/backend/parser/gram.y | 8 ++++
src/bin/psql/tab-complete.c | 11 +++++-
src/include/commands/cluster.h | 4 +-
src/include/commands/event_trigger.h | 1 +
src/include/nodes/parsenodes.h | 1 +
src/test/regress/expected/create_am.out | 34 +++++++++++++++++
src/test/regress/sql/create_am.sql | 17 +++++++++
11 files changed, 173 insertions(+), 15 deletions(-)