diff options
author | Michael Paquier <michael@paquier.xyz> | 2024-03-08 09:31:52 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2024-03-08 09:31:52 +0900 |
commit | d61a6cad6418f643a5773352038d0dfe5d3535b8 (patch) | |
tree | 10791cac8cc32610b5784768d966b2eaa0109f67 /src/backend/commands | |
parent | 4f8c1e7aaf11c42fa658eeab9baef0a035e76fe2 (diff) | |
download | postgresql-d61a6cad6418f643a5773352038d0dfe5d3535b8.tar.gz postgresql-d61a6cad6418f643a5773352038d0dfe5d3535b8.zip |
Add support for DEFAULT in ALTER TABLE .. SET ACCESS METHOD
This option can be used to switch a relation to use the access method
set by default_table_access_method when running the command.
This has come up when discussing the possibility to support setting
pg_class.relam for partitioned tables (left out here as future work),
while being useful on its own for relations with physical storage as
these must have an access method set.
Per suggestion from Justin Pryzby.
Author: Michael Paquier
Reviewed-by: Justin Pryzby
Discussion: https://postgr.es/m/ZeCZ89xAVFeOmrQC@pryzbyj2023
Diffstat (limited to 'src/backend/commands')
-rw-r--r-- | src/backend/commands/tablecmds.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index c61f9305c2e..7014be80396 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -15202,6 +15202,7 @@ ATExecDropCluster(Relation rel, LOCKMODE lockmode) * * Check that access method exists. If it is the same as the table's current * access method, it is a no-op. Otherwise, a table rewrite is necessary. + * If amname is NULL, select default_table_access_method as access method. */ static void ATPrepSetAccessMethod(AlteredTableInfo *tab, Relation rel, const char *amname) @@ -15209,7 +15210,8 @@ ATPrepSetAccessMethod(AlteredTableInfo *tab, Relation rel, const char *amname) Oid amoid; /* Check that the table access method exists */ - amoid = get_table_am_oid(amname, false); + amoid = get_table_am_oid(amname ? amname : default_table_access_method, + false); if (rel->rd_rel->relam == amoid) return; |