From c752b1c5e555fb0397b9c3a2ac918fa66584e615 Mon Sep 17 00:00:00 2001 From: jian he Date: Fri, 13 Jun 2025 14:24:11 +0800 Subject: [PATCH v44 1/1] documentation refactoring based on v44 --- doc/src/sgml/ref/alter_table.sgml | 38 +++++++++++++++---------------- src/backend/commands/tablecmds.c | 10 ++++---- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml index 855d2ca44db..e49e3362b55 100644 --- a/doc/src/sgml/ref/alter_table.sgml +++ b/doc/src/sgml/ref/alter_table.sgml @@ -1155,27 +1155,28 @@ WITH ( MODULUS numeric_literal, REM - This form merges several partitions into the one partition of the target table. - Hash-partitioning is not supported. If DEFAULT partition is not in the + This form merges several partitions of the target table into a new partition. + Hash-partitioned target table is not supported. + If DEFAULT partition is not in the list of partitions partition_name1, partition_name2 [, ...]: - For range-partitioned tables it is necessary that the ranges - of the partitions partition_name1, - partition_name2 [, ...] can - be merged into one range without spaces and overlaps (otherwise an error - will be generated). The combined range will be the range for the partition - partition_name. + For range-partitioned tables, the ranges of the partitions + partition_name1, + partition_name2, [...] + must be adjacent in order to be merged. Otherwise, an error will be + raised. The resulting combined range will be the new partition bound + for the partition partition_name. - For list-partitioned tables the value lists of all partitions + For list-partitioned tables, the partition bounds of partition_name1, - partition_name2 [, ...] are - combined and form the list of values of partition + partition_name2, [...] + are combined to form the new partition bound for partition_name. @@ -1186,13 +1187,15 @@ WITH ( MODULUS numeric_literal, REM The partition partition_name - will be the DEFAULT partition. + will be the new DEFAULT partition of the target table. - For range- and list-partitioned tables the ranges and lists of values - of the merged partitions can be any. + The partition bound specifications for all partitions- + partition_name1, + partition_name2, [...] + can be arbitrary. @@ -1211,11 +1214,8 @@ WITH ( MODULUS numeric_literal, REM into the new partition. Extended statistics aren't copied from the parent table, for consistency with CREATE TABLE PARTITION OF. - The new partition will have the same table access method as the parent. - If the parent table is persistent then the new partition is created - persistent. If the parent table is temporary then the new partition - is also created temporary. The new partition will also be created in - the same tablespace as the parent. + The new partition will inherit the same table access method, persistence + type, and tablespace as the parent table. When partitions are merged, any individual objects belonging to those diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 190ce952ade..c56b43c7fe5 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -22660,14 +22660,14 @@ moveMergedTablesRows(List **wqueue, Relation rel, } /* - * detachPartitionTable: detach partition "partRel" from partitioned table - * "rel" with default partition identifier "defaultPartOid" + * detachPartitionTable: detach partition "child_rel" from partitioned table + * "parent_rel" with default partition identifier "defaultPartOid" */ static void -detachPartitionTable(Relation partRel, Relation rel, Oid defaultPartOid) +detachPartitionTable(Relation child_rel, Relation parent_rel, Oid defaultPartOid) { /* Remove the pg_inherits row first. */ - RemoveInheritance(partRel, rel, false); + RemoveInheritance(child_rel, parent_rel, false); /* * Detaching the partition might involve TOAST table access, so ensure we @@ -22676,7 +22676,7 @@ detachPartitionTable(Relation partRel, Relation rel, Oid defaultPartOid) PushActiveSnapshot(GetTransactionSnapshot()); /* Do the final part of detaching. */ - DetachPartitionFinalize(rel, partRel, false, defaultPartOid); + DetachPartitionFinalize(parent_rel, child_rel, false, defaultPartOid); PopActiveSnapshot(); } -- 2.34.1