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
>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); ^^^^^