misleading error message in DefineIndex - Mailing list pgsql-hackers

From jian he
Subject misleading error message in DefineIndex
Date
Msg-id CACJufxH6VhAf65Vghg4T2q315gY=Rt4BUfMyunkfRj0n2S9n-g@mail.gmail.com
Whole thread Raw
List pgsql-hackers
hi.

while working on virtual generated column as partition key, I found below
errmsg the constraint type is hardcoded.

            if (!found)
            {
                Form_pg_attribute att;
                att = TupleDescAttr(RelationGetDescr(rel),
                                    key->partattrs[i] - 1);
                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))));
            }

create table idxpart (a int4range, constraint xx exclude USING GIST (a
with = ), b int4range ) partition by range (b);
ERROR:  unique constraint on partitioned table must include all
partitioning columns
DETAIL:  EXCLUDE constraint on table "idxpart" lacks column "b" which
is part of the partition key.

In the example above , the primary error message "unique
constraint..." seems confusing.


--
jian
https://www.enterprisedb.com/



pgsql-hackers by date:

Previous
From: Steven Niu
Date:
Subject: Re: Compile error on the aarch64 platform: Missing asm/hwcap.h
Next
From: Dilip Kumar
Date:
Subject: Re: Patch: dumping tables data in multiple chunks in pg_dump