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

From Robert Haas
Subject Re: wrong relkind error messages
Date
Msg-id CA+TgmoYBSDvQF40+kj3tdEyS3UpjFU+yFzJytxOefBwQfkBQzA@mail.gmail.com
Whole thread Raw
In response to wrong relkind error messages  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: wrong relkind error messages
List pgsql-hackers
On Mon, Apr 13, 2020 at 9:55 AM Peter Eisentraut
<peter.eisentraut@2ndquadrant.com> wrote:
> Attached is another attempt to improve this.

Nice effort. Most of these seem like clear improvements, but some I don't like:

+ errmsg("relation \"%s\" is of unsupported kind",
+ RelationGetRelationName(rel)),
+ errdetail_relkind(RelationGetRelationName(rel), rel->rd_rel->relkind)));

It would help to work "pgstattuple" into the message somehow. "cannot
use pgstattuple on relation \"%s\"", perhaps?

+ ereport(ERROR,
+ (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("action cannot be performed on relation \"%s\"",
+ RelationGetRelationName(rel)),

Super-vague.

+ errmsg("cannot set relation options of relation \"%s\"",
+ RelationGetRelationName(rel)),

I suggest "cannot set options for relation \"%s\""; that is, use "for"
instead of "of", and don't say "relation" twice.

+ errmsg("cannot create trigger on relation \"%s\"",
+ RelationGetRelationName(rel)),
+ errmsg("relation \"%s\" cannot have triggers",
+ RelationGetRelationName(rel)),
+ errmsg("relation \"%s\" cannot have triggers",
+ rv->relname),

Maybe use the second wording for all three? And similarly for rules?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: pg_validatebackup -> pg_verifybackup?
Next
From: Robert Haas
Date:
Subject: Re: pg_basebackup, manifests and backends older than ~12