Re: wrong relkind error messages - Mailing list pgsql-hackers

From Tom Lane
Subject Re: wrong relkind error messages
Date
Msg-id 10405.1586909753@sss.pgh.pa.us
Whole thread Raw
In response to Re: wrong relkind error messages  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: wrong relkind error messages  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List pgsql-hackers
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> On 2020-Apr-13, Robert Haas wrote:
>> + ereport(ERROR,
>> + (errcode(ERRCODE_WRONG_OBJECT_TYPE),
>> + errmsg("action cannot be performed on relation \"%s\"",
>> + RelationGetRelationName(rel)),
>> 
>> Super-vague.

> Maybe, but note that the patch proposed to replace this current error
> message:
>   ERROR:  foo is not an index or foreign table
> ...
> so it's not like this is making things any worse; the error was already
> super-vague.  

Yeah.  I share Robert's feeling that "action" is not really desirable
here, but I have to concur that this is an improvement on the existing
text, which also fails to mention what command is being rejected.

> This could be improved if we had stringification of ALTER TABLE
> subcommand types:
>   ERROR:  ALTER TABLE ... ADD COLUMN cannot be performed on "foo"

In the meantime could we at least say "ALTER TABLE action cannot
be performed"?  The worst aspect of the existing text is that if
an error comes out of a script with a lot of different commands,
it doesn't give you any hint at all about which command failed.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_basebackup, manifests and backends older than ~12
Next
From: Andy Fan
Date:
Subject: Re: [PATCH] Keeps tracking the uniqueness with UniqueKey