mirror of
https://github.com/postgres/postgres.git
synced 2025-06-14 18:42:34 +03:00
Inherit parent's AM for partition MERGE/SPLIT operations
This commit makes new partitions created by ALTER TABLE ... SPLIT PARTITION and ALTER TABLE ... MERGE PARTITIONS commands inherit the paret table access method. Reported-by: Alexander Lakhin Discussion: https://postgr.es/m/84ada05b-be5c-473e-6d1c-ebe5dd21b190%40gmail.com Reviewed-by: Pavel Borisov
This commit is contained in:
@ -21213,6 +21213,11 @@ moveSplitTableRows(Relation rel, Relation splitRel, List *partlist, List *newPar
|
||||
*
|
||||
* Emulates command: CREATE [TEMP] TABLE <newPartName> (LIKE <modelRel's name>
|
||||
* INCLUDING ALL EXCLUDING INDEXES EXCLUDING IDENTITY)
|
||||
*
|
||||
* Also, this function sets the new partition access method same as parent
|
||||
* table access methods (similarly to CREATE TABLE ... PARTITION OF). It
|
||||
* checks that parent and child tables have compatible persistence.
|
||||
*
|
||||
* Function returns the created relation (locked in AccessExclusiveLock mode).
|
||||
*/
|
||||
static Relation
|
||||
@ -21243,6 +21248,7 @@ createPartitionTable(RangeVar *newPartName, Relation modelRel,
|
||||
createStmt->oncommit = ONCOMMIT_NOOP;
|
||||
createStmt->tablespacename = NULL;
|
||||
createStmt->if_not_exists = false;
|
||||
createStmt->accessMethod = get_am_name(modelRel->rd_rel->relam);
|
||||
|
||||
tlc = makeNode(TableLikeClause);
|
||||
tlc->relation = makeRangeVar(get_namespace_name(RelationGetNamespace(modelRel)),
|
||||
|
Reference in New Issue
Block a user