Re: wrong relkind error messages

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: wrong relkind error messages
Date: 2020-04-13 15:13:15
Message-ID: 989.1586790795@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2020-04-13 15:15:53 Re: backup manifests
Previous Message Robert Haas 2020-04-13 15:13:06 Re: pg_basebackup, manifests and backends older than ~12