Re: wrong relkind error messages

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: wrong relkind error messages
Date: 2021-06-24 08:12:49
Message-ID: 01d4fd55-d4fe-5afc-446c-a7f99e043f3d@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 13.04.20 15:54, Peter Eisentraut wrote:
> I'm not a fan of error messages like
>
>     relation "%s" is not a table, foreign table, or materialized view
>
> It doesn't tell me what's wrong, it only tells me what else could have
> worked.  It's also tedious to maintain and the number of combinations
> grows over time.

Another go at this. I believe in the attached patch I have addressed
all the feedback during this thread last year. In particular, I have
rephrased the detail message per discussion, and I have improved the
messages produced by ATSimplePermissions() with more details. Examples:

CREATE STATISTICS tststats.s2 ON a, b FROM tststats.ti;
-ERROR: relation "ti" is not a table, foreign table, or materialized view
+ERROR: cannot define statistics for relation "ti"
+DETAIL: This operation is not supported for indexes.

ALTER FOREIGN TABLE ft1 ALTER CONSTRAINT ft1_c9_check DEFERRABLE; -- ERROR
-ERROR: "ft1" is not a table
+ERROR: ALTER action ALTER CONSTRAINT cannot be performed on relation "ft1"
+DETAIL: This operation is not supported for foreign tables.

There might be room for some wordsmithing in a few places, but generally
I think this is complete.

Attachment Content-Type Size
v2-0001-Improve-error-messages-about-mismatching-relkind.patch text/plain 76.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Nancarrow 2021-06-24 08:42:37 Re: Added schema level support for publication.
Previous Message Fabien COELHO 2021-06-24 06:46:03 Re: pgbench logging broken by time logic changes