Thread
-
Re: [PATCH] Fix duplicate errmsg in ALTER TABLE SPLIT PARTITION
jian he <jian.universality@gmail.com> — 2026-05-05T11:52:35Z
On Tue, May 5, 2026 at 3:15 PM John Naylor <johncnaylorls@gmail.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. -- jian https://www.enterprisedb.com/