Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
От | jian he |
---|---|
Тема | Re: Add SPLIT PARTITION/MERGE PARTITIONS commands |
Дата | |
Msg-id | CACJufxEH45Rtkn=n9hjakeKEkH7ou8domh+iQHMp+18Wq_L-4g@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Add SPLIT PARTITION/MERGE PARTITIONS commands (jian he <jian.universality@gmail.com>) |
Список | pgsql-hackers |
On Thu, Aug 21, 2025 at 2:45 PM jian he <jian.universality@gmail.com> wrote: > > On Thu, Aug 21, 2025 at 10:53 AM jian he <jian.universality@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.
Вложения
В списке pgsql-hackers по дате отправления: