Re: [PATCH] Fix duplicate errmsg in ALTER TABLE SPLIT PARTITION - Mailing list pgsql-hackers

From jian he
Subject Re: [PATCH] Fix duplicate errmsg in ALTER TABLE SPLIT PARTITION
Date
Msg-id CACJufxEBjoH0pOYVyoBKn+WTiF+1_bCmQ7wfa8rSZ1QiHjQqzA@mail.gmail.com
Whole thread
In response to Re: [PATCH] Fix duplicate errmsg in ALTER TABLE SPLIT PARTITION  (Ayush Tiwari <ayushtiwari.slg01@gmail.com>)
Responses Re: [PATCH] Fix duplicate errmsg in ALTER TABLE SPLIT PARTITION
List pgsql-hackers
On Tue, Apr 21, 2026 at 5:37 PM Ayush Tiwari
<ayushtiwari.slg01@gmail.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/



pgsql-hackers by date:

Previous
From: Chao Li
Date:
Subject: Re: Cleanup shadows variable warnings, round 1
Next
From: Masahiko Sawada
Date:
Subject: Re: Fix pg_upgrade to detect invalid logical replication slots on PG19