On Sat, Mar 10, 2018 at 10:54 AM, legrand legrand <legrand_legrand@xxxxxxxxxxx> wrote:
I thougth that thoses messages where using relation's relkind:
r = ordinary table,
i = index,
S = sequence,
t = TOAST table,
v = view,
m = materialized view,
c = composite type,
f = foreign table,
p = partitioned table
wouldn't it be easier to read for beginners ?
Regards
PAscal
--
Sent from: http://www.postgresql-archive.org/PostgreSQL-general- f1843780.html
>message speaks about relation (and not index)
>Would it be possible that this message reports the correct object type ?
>I thougth that thoses messages where using relation's relkind:
>wouldn't it be easier to read for beginners ?
PostgreSQL is a "relational" database, and as such _all_ objects in the database are
considered _relations_, even indexes. Therefore, the error message is correct, because
_relation_ NEWINDEX already exists.
I believe that the code is generic as the clause "IF EXISTS" checks against pg_class
for other _relations_ as defined in relkind, and therefore reports a generic message as
"relation _relname_ already exists"
To report on a specific relation type would be redundant, because you already know
from your SQL statement what type/relkind of relation you are trying to CREATE.
IE: SQL> create index if not exists NEWINDEX on SCHEMA.TABLE(COL);
^^^^^
--
Melvin Davidson
Maj. Database & Exploration Specialist
Universe Exploration Command – UXC
Employment by invitation only!
Maj. Database & Exploration Specialist
Universe Exploration Command – UXC
Employment by invitation only!