Re: misleading error message in DefineIndex - Mailing list pgsql-hackers

From Tom Lane
Subject Re: misleading error message in DefineIndex
Date
Msg-id 2405254.1767981926@sss.pgh.pa.us
Whole thread Raw
In response to Re: misleading error message in DefineIndex  (jian he <jian.universality@gmail.com>)
List pgsql-hackers
jian he <jian.universality@gmail.com> writes:
> On Mon, Nov 17, 2025 at 8:52 PM Daniel Gustafsson <daniel@yesql.se> wrote:
>>
>> Some of the internals does seem bleed through.  Do you want to work on a patch
>> for a suggestion on an improvement?

> I have changed this ereport:
>          errmsg("unique constraint on partitioned table must include
> all partitioning columns"),
> to
> +                        errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
> +                        errmsg("%s constraint on partitioned table
> must include all partitioning columns", constraint_type),

I pushed this patch with minor editorialization:

* I didn't agree with changing the errdetail message.  Yeah, adding
"partitioned" there could be argued to be an improvement, but it's
not essential given that the main message already specifies that we're
talking about a partitioned table.  So I judged that change not worth
the work it would impose on translators.

* I put in translator: comments so that translators don't need to
consult the source code to guess what the %s stands for.

* I put back the extra ereport parentheses, because removing them
mainly served to obscure what the patch was changing and what it
wasn't.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: pg_upgrade: optimize replication slot caught-up check
Next
From: Dave Cramer
Date:
Subject: Re: Proposal to allow setting cursor options on Portals