| From: | John Naylor <johncnaylorls(at)gmail(dot)com> |
|---|---|
| To: | Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com> |
| Cc: | jian he <jian(dot)universality(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-05-05 07:15:37 |
| Message-ID: | CANWCAZaU4_d-2-3UpjctKKEqFy0o+gLA_v0vEvjmR_1W-5ZxQQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Wed, Apr 29, 2026 at 5:03 PM Ayush Tiwari
<ayushtiwari(dot)slg01(at)gmail(dot)com> wrote:
> - For SPLIT, switch the adjacency error to
> errmsg("cannot split partition \"%s\"",
> get_rel_name(splitPartOid)),
> so it names the old partition, matching the merge wording style.
> To make splitPartOid available there, I added an Oid splitPartOid
> parameter to check_two_partitions_bounds_range() and pass
> InvalidOid from the merge call site (where is_merge is true so
> the parameter is unused).
If we have splitPartOid, then the boolean is_merge is redundant and
can be removed, right? To keep the intent clear we can add a local
variable
bool is_merge = (splitPartOid == NULL ? true : false);
Other than that, both patches LGTM.
Observation:
- errmsg("can not split non-DEFAULT partition \"%s\"",
+ errmsg("cannot split non-DEFAULT partition \"%s\"",
get_rel_name(splitPartOid)),
- errmsg("new partition cannot be DEFAULT because...
+ errdetail("New partition cannot be DEFAULT because...
-ERROR: new partition cannot be DEFAULT because DEFAULT partition
"sales_others" already exists
+ERROR: cannot split non-DEFAULT partition "sales_all"
LINE 5: PARTITION sales_others2 DEFAULT);
^
+DETAIL: New partition cannot be DEFAULT because DEFAULT partition
"sales_others" already exists.
If there are two errmsg's back-to-back, only the second one displays.
Maybe some automated tooling can detect cases like this going forward?
--
John Naylor
Amazon Web Services
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Amul Sul | 2026-05-05 07:23:33 | Re: Cleanup: Replace sscanf with strtol/strtoul in snapmgr |
| Previous Message | Amul Sul | 2026-05-05 06:37:19 | Server crash: Use-after-free in AfterTriggerEndQuery() |