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

From: Melvin Davidson <melvin6925(at)gmail(dot)com>
To: legrand legrand <legrand_legrand(at)hotmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: wrong message when trying to create an already existing index
Date: 2018-03-10 16:14:20
Message-ID: CANu8FiyiWwKahzA=2dg87zJS8PoGcceMMG=mCGhQKmTO1oZTWA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Mar 10, 2018 at 10:54 AM, legrand legrand <
legrand_legrand(at)hotmail(dot)com> 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_classfor 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 knowfrom
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!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message legrand legrand 2018-03-10 16:49:28 Re: wrong message when trying to create an already existing index
Previous Message legrand legrand 2018-03-10 15:54:07 Re: wrong message when trying to create an already existing index