Unclear error message - Mailing list pgsql-hackers

From Laurenz Albe
Subject Unclear error message
Date
Msg-id c11c05810a9ed65e9b2c817a9ef442275a32fe80.camel@cybertec.at
Whole thread Raw
Responses Re: Unclear error message  (Michael Paquier <michael@paquier.xyz>)
List 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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: generating bootstrap entries for array types
Next
From: Christoph Berg
Date:
Subject: Re: [patch] Support LLVM 7