Re: [PATCH] Fix duplicate errmsg in ALTER TABLE SPLIT PARTITION

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
Cc: John Naylor <johncnaylorls(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Daniel Gustafsson <daniel(at)yesql(dot)se>
Subject: Re: [PATCH] Fix duplicate errmsg in ALTER TABLE SPLIT PARTITION
Date: 2026-04-22 07:28:35
Message-ID: CACJufxEBjoH0pOYVyoBKn+WTiF+1_bCmQ7wfa8rSZ1QiHjQqzA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Apr 21, 2026 at 5:37 PM Ayush Tiwari
<ayushtiwari(dot)slg01(at)gmail(dot)com> wrote:
>
> Reattaching patch with right format for cfbot.
>

--- a/src/backend/partitioning/partbounds.c
+++ b/src/backend/partitioning/partbounds.c
@@ -5030,20 +5030,18 @@ check_two_partitions_bounds_range(Relation parent,
if (is_merge)
ereport(ERROR,
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
- errmsg("can not merge partition \"%s\" together with partition \"%s\"",
+ errmsg("cannot merge non-adjacent partitions \"%s\" and \"%s\"",
second_name->relname, first_name->relname),
- errdetail("lower bound of partition \"%s\" is not equal to the upper
bound of partition \"%s\"",
+ errdetail("Lower bound of partition \"%s\" is not equal to upper
bound of partition \"%s\".",
second_name->relname, first_name->relname),
- errhint("ALTER TABLE ... MERGE PARTITIONS requires the partition
bounds to be adjacent."),

- errhint("ALTER TABLE ... SPLIT PARTITION requires the partition
bounds to be adjacent."),

I am not so sure these errhint are redundant, maybe the errdeatil is redundant.
I am ok with:
+ errmsg("cannot merge non-adjacent partitions \"%s\" and \"%s\"",
second_name->relname, first_name->relname),
+ errhint("ALTER TABLE ... MERGE PARTITIONS requires the partition
bounds to be adjacent."),

in partition_split.sql, partition_merge.sql,
I agree with that.sql file has "-- ERROR:" comments that are
exact copies of the error message, is not great. But you suddenly delete all
these comments seems not good.

We can add the `-- ERROR` comment suffix, as used in
contrib/file_fdw/sql/file_fdw.sql
or group them and add a comment like ``-- none of the following should
be accepted``,
as seen in src/test/regress/sql/arrays.sql.

--
jian
https://www.enterprisedb.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2026-04-22 08:02:20 Re: Fix pg_upgrade to detect invalid logical replication slots on PG19
Previous Message Chao Li 2026-04-22 07:24:37 Re: Cleanup shadows variable warnings, round 1