On Thu, Aug 21, 2025 at 2:45 PM jian he <jian.universal...@gmail.com> wrote: > > On Thu, Aug 21, 2025 at 10:53 AM jian he <jian.universal...@gmail.com> wrote: > > > > > this time, I only checked > > > v52-0001-Implement-ALTER-TABLE-.-MERGE-PARTITIONS-.-comma.patch
hi. +static void +check_two_partitions_bounds_range(Relation parent, +{ .... + + ereport(ERROR, + errcode(ERRCODE_INVALID_OBJECT_DEFINITION), + errmsg("lower bound of partition \"%s\" is not equal to the upper bound of partition \"%s\"", + second_name->relname, first_name->relname), + errhint("ALTER TABLE ... MERGE PARTITIONS requires the partition bounds to be adjacent."), + parser_errposition(pstate, datum->location)); + } I propose change it to: ereport(ERROR, errcode(ERRCODE_INVALID_OBJECT_DEFINITION), errmsg("can not merge partition \"%s\" together with partition \"%s\"", second_name->relname, first_name->relname), errdetail("lower bound of partition \"%s\" is not equal to the upper bound of partition \"%s\"", second_name->relname, first_name->relname), errhint("ALTER TABLE ... MERGE PARTITIONS requires the partition bounds to be adjacent."), parser_errposition(pstate, datum->location)); <para> + There is also an option for merging multiple table partitions into + a single partition using the + <link linkend="sql-altertable-merge-partitions"><command>ALTER TABLE ... MERGE PARTITIONS</command></link>. + This feature simplifies the management of partitioned tables by allowing + users to combine partitions that are no longer needed as + separate entities. It's important to note that this operation is not + supported for hash-partitioned tables and acquires an + <literal>ACCESS EXCLUSIVE</literal> lock, which could impact high-load + systems due to the lock's restrictive nature. For example, we can + merge three monthly partitions into one quarter partition: I am not sure last sentence "merge three monthly partitions into one quarter partition:" is correct. buildExpressionExecutionStates seems not needed, same reason as mentioned before, code pattern aligned with ATRewriteTable. while at it, also did some minor changes.
v52-0001-refactor-buildExpressionExecutionStates.no-cfbot
Description: Binary data