Re: Bug #895: incorrect error message when duplicate index name

From: greg(at)turnstep(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Cc: taras(at)dekasoft(dot)com(dot)ua
Subject: Re: Bug #895: incorrect error message when duplicate index name
Date: 2003-02-13 14:53:24
Message-ID: 5169e4b75ea5c36115e84a61703e353b@biglumber.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> Long Description
> ERROR: relation named "pk_exchange_batch_idx" already exists
> Why relation when I create index?

An index is a type of relation: other types of relations include tables,
views, and sequences. A relation is simply something in the database that
can be represented as a table. Each relations must have a unique name, no
matter what type it is:

=> create table foobar(a int);
CREATE TABLE

=> create index foobar on foobar(a);
ERROR: relation named "foobar" already exists

=> create view foobar as select * from foobar;
ERROR: Relation 'foobar' already exists

You can see from the last example why having the same name would be a
problem - does "SELECT * FROM foobar" refer to the table 'foobar'
or the view 'foobar'? If we did not have the unique name contraint,
we would have to tell the database which 'foobar' we meant.

The error message you received means that *something* else already
has that name, but not necessarily an index.

- --
Greg Sabino Mullane greg(at)turnstep(dot)com
PGP Key: 0x14964AC8 200302130948
-----BEGIN PGP SIGNATURE-----
Comment: http://www.turnstep.com/pgp.html

iD8DBQE+S7B4vJuQZxSWSsgRAluSAJ9lLglRRijBRhCbIh6/v5pQm0U1zACgjIKz
/AZ9yAdOsZ2xoF2xwp/YKS8=
=VW2o
-----END PGP SIGNATURE-----

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Florian Wunderlich 2003-02-13 16:27:21 Re: Bug #866 related problem (ATTN Tom Lane)
Previous Message Greger Burman 2003-02-13 14:09:01 postmaster missing