| From: | jian he <jian(dot)universality(at)gmail(dot)com> |
|---|---|
| To: | John Naylor <johncnaylorls(at)gmail(dot)com> |
| Cc: | Ayush Tiwari <ayushtiwari(dot)slg01(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 11:52:35 |
| Message-ID: | CACJufxHWE=898fu2YX_T01yckJcrL5KcEBp0Cwhkvq66snJ0sw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, May 5, 2026 at 3:15 PM John Naylor <johncnaylorls(at)gmail(dot)com> wrote:
>
> 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?
>
Add an Assert in function errmsg, it will crashes the server when two
errmsg back-to-back:
Assert(edata->message == NULL);
EVALUATE_MESSAGE(edata->domain, message, false, true);
Function FreeErrorDataContents change to
```
if (edata->message)
{
pfree(edata->message);
edata->message = NULL;
}
```
Most of the tests succeeded on my local machines.
Ok: 373
Expected Fail: 0
Fail: 0
Unexpected Pass: 0
Skipped: 23
Timeout: 0
I'm not sure if ereport_domain acts differently when
HAVE_PG_INTEGER_CONSTANT_P is true.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | John Naylor | 2026-05-05 11:56:37 | Re: vectorized CRC on ARM64 |
| Previous Message | Soumya S Murali | 2026-05-05 11:34:13 | Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement |