Allow specifying an access method for partitioned tables
Alvaro Herrera <alvherre@alvh.no-ip.org>
Allow specifying an access method for partitioned tables It's now possible to specify a table access method via CREATE TABLE ... USING for a partitioned table, as well change it with ALTER TABLE ... SET ACCESS METHOD. Specifying an AM for a partitioned table lets the value be used for all future partitions created under it, closely mirroring the behavior of the TABLESPACE option for partitioned tables. Existing partitions are not modified. For a partitioned table with no AM specified, any new partitions are created with the default_table_access_method. Also add ALTER TABLE ... SET ACCESS METHOD DEFAULT, which reverts to the original state of using the default for new partitions. The relcache of partitioned tables is not changed: rd_tableam is not set, even if a partitioned table has a relam set. Author: Justin Pryzby <pryzby@telsasoft.com> Author: Soumyadeep Chakraborty <soumyadeep2007@gmail.com> Author: Michaël Paquier <michael@paquier.xyz> Reviewed-by: The authors themselves Discussion: https://postgr.es/m/CAE-ML+9zM4wJCGCBGv01k96qQ3gFv4WFcFy=zqPHKeaEFwwv6A@mail.gmail.com Discussion: https://postgr.es/m/20210308010707.GA29832%40telsasoft.com
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/catalogs.sgml | modified | +7 −3 |
| doc/src/sgml/ref/alter_table.sgml | modified | +14 −4 |
| doc/src/sgml/ref/create_table.sgml | modified | +4 −0 |
| src/backend/commands/tablecmds.c | modified | +135 −30 |
| src/backend/utils/cache/lsyscache.c | modified | +22 −0 |
| src/backend/utils/cache/relcache.c | modified | +7 −0 |
| src/bin/pg_dump/pg_dump.c | modified | +2 −1 |
| src/bin/pg_dump/t/002_pg_dump.pl | modified | +35 −0 |
| src/include/catalog/pg_class.h | modified | +3 −1 |
| src/include/utils/lsyscache.h | modified | +1 −0 |
| src/test/regress/expected/create_am.out | modified | +152 −6 |
| src/test/regress/sql/create_am.sql | modified | +87 −4 |
Documentation touched
Discussion
- alter table set TABLE ACCESS METHOD 41 messages · 2021-02-28 → 2021-08-10
- ALTER TABLE SET ACCESS METHOD on partitioned tables 70 messages · 2022-05-18 → 2024-07-02