Bug #609: CREATE TABLE with implicit index should not fail if index already exists - Mailing list pgsql-bugs

From pgsql-bugs@postgresql.org
Subject Bug #609: CREATE TABLE with implicit index should not fail if index already exists
Date
Msg-id 20020307172739.4A12F47612E@postgresql.org
Whole thread Raw
List pgsql-bugs
Vladimir (VAndrianov@Omeda.com) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
CREATE TABLE with implicit index should not fail if index already exists

Long Description
When PostgreSQL tries to create implicit index during table creation and assumed index's name already exists it fails.
Probably, it's not a bug, but I don't think this behavior is right.
When your intent is to create table with implicit indices you likely don't care about names of those indices. I think
inthis situation PostgreSQL have to construct some unique index name that doesn't conflict with any existent names.
 


Sample Code
demo=# select version();
                            version
---------------------------------------------------------------
 PostgreSQL 7.1.3 on i686-pc-linux-gnu, compiled by GCC 2.95.4
(1 row)

demo=# create table tst1 (c1 int2 unique);
NOTICE:  CREATE TABLE/UNIQUE will create implicit index 'tst1_c1_key' for table 'tst1'
CREATE
demo=# alter table tst1 rename to tst2;
ALTER
demo=# create table tst1 (c1 int2 unique);
NOTICE:  CREATE TABLE/UNIQUE will create implicit index 'tst1_c1_key' for table 'tst1'
ERROR:  Cannot create index: 'tst1_c1_key' already exists

No file was uploaded with this report

pgsql-bugs by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: regression - postgresql 7.2 on power pc/linux
Next
From: pgsql-bugs@postgresql.org
Date:
Subject: Bug #610: collation fails sorting because of strcoll() bug