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.