pgsql: Add support for SET ACCESS METHOD in ALTER TABLE

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add support for SET ACCESS METHOD in ALTER TABLE
Date: 2021-07-28 01:11:49
Message-ID: E1m8Y6v-0007pk-P9@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add support for SET ACCESS METHOD in ALTER TABLE

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
Reviewed-by: Michael Paquier, Vignesh C
Discussion: https://postgr.es/m/20210228222530.GD20769@telsasoft.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b0483263dda0824cc49e3f8a022dab07e1cdf9a7

Modified Files
--------------
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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2021-07-28 01:32:16 pgsql: Clarify some comments making use of leetspeak term "up2date"
Previous Message David Rowley 2021-07-28 00:57:09 pgsql: Remove seemingly unneeded include directory in MSVC scripts