Re: wrong message when trying to create an already existing index - Mailing list pgsql-general

From Tom Lane
Subject Re: wrong message when trying to create an already existing index
Date
Msg-id 23126.1520701805@sss.pgh.pa.us
Whole thread Raw
In response to Re: wrong message when trying to create an already existing index  (legrand legrand <legrand_legrand@hotmail.com>)
Responses Re: wrong message when trying to create an already existing index  (legrand legrand <legrand_legrand@hotmail.com>)
List pgsql-general
legrand legrand <legrand_legrand@hotmail.com> writes:
> I thougth that thoses messages where using relation's relkind:
> ..
> wouldn't it be easier to read for beginners ?

I doubt it would be an improvement.  Consider this example:

regression=# create table t1 (f1 int);
CREATE TABLE
regression=# create materialized view mv1 as select * from t1;
SELECT 0
regression=# create index mv1 on t1 (f1);
ERROR:  relation "mv1" already exists

You seem to be proposing that the error should read either

ERROR:  index "mv1" already exists

which would be a lie, or

ERROR:  materialized view "mv1" already exists

which while accurate seems to me to be *more* confusing not less.
A person who did not understand that these relation types all
share the same namespace would probably not get enlightened
this way.  Using the generic term "relation" is just as accurate,
and it might help somebody understand that the problem is exactly
that relations of different types share the same namespace.

            regards, tom lane


pgsql-general by date:

Previous
From: legrand legrand
Date:
Subject: Re: wrong message when trying to create an already existing index
Next
From: Bruce Momjian
Date:
Subject: Re: momjian.us is down?