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

From Peter Eisentraut
Subject Re: wrong relkind error messages
Date
Msg-id 01d4fd55-d4fe-5afc-446c-a7f99e043f3d@enterprisedb.com
Whole thread Raw
In response to wrong relkind error messages  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: wrong relkind error messages
Re: wrong relkind error messages
List 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

pgsql-hackers by date:

Previous
From: Fabien COELHO
Date:
Subject: Re: pgbench logging broken by time logic changes
Next
From: Greg Nancarrow
Date:
Subject: Re: Added schema level support for publication.