Re: wrong message when trying to create an already existing index

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: legrand legrand <legrand_legrand(at)hotmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: wrong message when trying to create an already existing index
Date: 2018-03-10 17:10:05
Message-ID: 23126.1520701805@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

legrand legrand <legrand_legrand(at)hotmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2018-03-10 17:27:04 Re: momjian.us is down?
Previous Message legrand legrand 2018-03-10 16:49:28 Re: wrong message when trying to create an already existing index