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

From Alvaro Herrera
Subject Re: wrong relkind error messages
Date
Msg-id 20200414230208.GA27948@alvherre.pgsql
Whole thread Raw
In response to Re: wrong relkind error messages  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: wrong relkind error messages
Re: wrong relkind error messages
List pgsql-hackers
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
with 
  ERROR:  action cannot be performed on "foo"
  DETAIL:  "foo" is a materialized view.

or, if we're to adopt Tom's proposed wording,

  ERROR:  cannot perform action on relation "ti"
  DETAIL:  This operation is not supported for materialized views.

so it's not like this is making things any worse; the error was already
super-vague.  

This could be improved if we had stringification of ALTER TABLE
subcommand types:

  ERROR:  ALTER TABLE ... ADD COLUMN cannot be performed on "foo"
  DETAIL:  "foo" is a gummy bear.
or
  ERROR:  ALTER TABLE ... ADD COLUMN cannot be performed on foo
  DETAIL:  This action cannot be performed on gummy bears.

but that seems material for a different patch.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: pg_basebackup, manifests and backends older than ~12
Next
From: Tom Lane
Date:
Subject: Re: pg_basebackup, manifests and backends older than ~12