Re: misleading error message in DefineIndex

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: misleading error message in DefineIndex
Date: 2026-01-09 18:05:26
Message-ID: 2405254.1767981926@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

jian he <jian(dot)universality(at)gmail(dot)com> writes:
> On Mon, Nov 17, 2025 at 8:52 PM Daniel Gustafsson <daniel(at)yesql(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Cramer 2026-01-09 18:20:34 Re: Proposal to allow setting cursor options on Portals
Previous Message Masahiko Sawada 2026-01-09 18:03:43 Re: pg_upgrade: optimize replication slot caught-up check