Unclear error message

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Unclear error message
Date: 2018-09-20 19:45:09
Message-ID: c11c05810a9ed65e9b2c817a9ef442275a32fe80.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

In backend/commands/tablecmds.c, function ATAddForeignKeyConstraint, I find:

if (rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
{
if (!recurse)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("foreign key referencing partitioned table \"%s\" must not be ONLY",
RelationGetRelationName(pkrel))));

That message is wrong, because "rel" and not "pkrel" is the partitioned table.
I think it should be

ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("foreign key cannot be defined on ONLY \"%s\" for a partitioned table",
Relatio
nGetRelationName(rel))));

Yours,
Laurenz Albe

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2018-09-20 20:13:06 Re: Code of Conduct
Previous Message Tom Lane 2018-09-20 19:30:05 Re: generating bootstrap entries for array types