misleading error message in DefineIndex

Поиск
Список
Период
Сортировка
От jian he
Тема misleading error message in DefineIndex
Дата
Msg-id CACJufxH6VhAf65Vghg4T2q315gY=Rt4BUfMyunkfRj0n2S9n-g@mail.gmail.com
обсуждение исходный текст
Ответы Re: misleading error message in DefineIndex
Список 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 по дате отправления: