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

From Tom Lane
Subject Re: wrong relkind error messages
Date
Msg-id 989.1586790795@sss.pgh.pa.us
Whole thread Raw
In response to wrong relkind error messages  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: wrong relkind error messages  (Andrew Dunstan <andrew.dunstan@2ndquadrant.com>)
Re: wrong relkind error messages  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> I'm not a fan of error messages like
>      relation "%s" is not a table, foreign table, or materialized view

Agreed, they're not great.

> For example:

> -ERROR:  relation "ti" is not a table, foreign table, or materialized view
> +ERROR:  cannot define statistics for relation "ti"
> +DETAIL:  "ti" is an index.

I see where you'e going, and it seems like a generally-better idea,
but I feel like this phrasing is omitting some critical background
information that users don't necessarily have.  At the very least
it's not stating clearly that the failure is *because* ti is an
index.  More generally, the whole concept that statistics can only
be defined for certain kinds of relations has disappeared from view.
I fear that users who're less deeply into Postgres hacking than we
are might not have that concept at all, or at least it might not
come to mind immediately when they get this message.

Fixing this while avoiding your concern about proliferation of messages
seems a bit difficult though.  The best I can do after a couple minutes'
thought is

ERROR:  cannot define statistics for relation "ti"
DETAIL:  "ti" is an index, and this operation is not supported for that
kind of relation.

which seems a little long and awkward.  Another idea is

ERROR:  cannot define statistics for relation "ti"
DETAIL:  This operation is not supported for indexes.

which still leaves implicit that "ti" is an index, but probably that's
something the user can figure out.

Maybe someone else can do better?

            regards, tom lane



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: pg_basebackup, manifests and backends older than ~12
Next
From: Robert Haas
Date:
Subject: Re: backup manifests