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