Re: misleading error message in DefineIndex
jian he <jian.universality@gmail.com>
From: jian he <jian.universality@gmail.com>
To: Daniel Gustafsson <daniel@yesql.se>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2025-11-18T07:22:09Z
Lists: pgsql-hackers
Attachments
- v1-0001-Minor-enhancement-to-the-error-message-in-DefineIndex.patch (text/x-patch) patch v1-0001
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? Maybe it could be possible to improve the
> wording by incorporating constraint_type in some way?
>
I have changed this ereport:
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("unique constraint on partitioned table must include
all partitioning columns"),
errdetail("%s constraint on table \"%s\" lacks column \"%s\"
which is part of the partition key.",
constraint_type, RelationGetRelationName(rel),
NameStr(att->attname))));
to
+ errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("%s constraint on partitioned table
must include all partitioning columns", constraint_type),
+ errdetail("%s constraint on partitioned table
\"%s\" lacks column \"%s\" which is part of the partition key.",
+ constraint_type,
RelationGetRelationName(rel),
+ NameStr(att->attname)));
Commits
-
Improve "constraint must include all partitioning columns" message.
- 7a1d422e39ba 19 (unreleased) landed