Bug #609: CREATE TABLE with implicit index should not fail if index already exists

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #609: CREATE TABLE with implicit index should not fail if index already exists
Date: 2002-03-07 17:27:39
Message-ID: 20020307172739.4A12F47612E@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Vladimir (VAndrianov(at)Omeda(dot)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 in this 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

Browse pgsql-bugs by date

  From Date Subject
Next Message pgsql-bugs 2002-03-07 19:36:16 Bug #610: collation fails sorting because of strcoll() bug
Previous Message Laurent FAILLIE 2002-03-07 16:36:33 Re: Bug #608: cache lookup failed