Re: [HACKERS] BUG with UNIQUE clause

From: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
To: Stéphane FILLON <fillons(at)offratel(dot)nc>
Cc: pgsql-general <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] BUG with UNIQUE clause
Date: 1999-09-15 01:52:43
Message-ID: 37DEFBEB.8D75D0FB@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-sql

> The UNIQUE constraint doesn't work on a field if I use a DEFAULT
> clause on a table.
> The following table works with UNIQUE constraint:
> but this one accept several same tcnom value:
> create table cltclt001(
> tcid int2 default nextval('cltcls001'),
> tcnom text unique
> );
> What's wrong with my table ?

Nothing. You have stumbled across a bug recently discovered by Mark
Dalphin <mdalphin(at)amgen(dot)com> in the parser. It was repaired in the
source trees 1999-08-15 so will appear in v6.5.2 (any day now) and
v6.6.

postgres=> create sequence cltcls001;
CREATE
postgres=> insert into cltclt001 (tcnom) values ('one');
INSERT 150559 1
postgres=> insert into cltclt001 (tcnom) values ('one');
ERROR: Cannot insert a duplicate key into a unique index

I imagine that the repair is posted to the patches or hacker's mailing
list; look in the archives around that date and you should be able to
patch your existing recent system.

Good luck.

- Thomas

--
Thomas Lockhart lockhart(at)alumni(dot)caltech(dot)edu
South Pasadena, California

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Nuchanach Klinjun 1999-09-15 04:21:48 Re: [HACKERS] Permission problem with COPY FROM
Previous Message Michael Simms 1999-09-14 18:43:14 Re: [GENERAL] max() question

Browse pgsql-hackers by date

  From Date Subject
Next Message Nuchanach Klinjun 1999-09-15 04:21:48 Re: [HACKERS] Permission problem with COPY FROM
Previous Message Damond Walker 1999-09-15 01:40:47 Re: [HACKERS] Performance of MIN() and MAX()

Browse pgsql-sql by date

  From Date Subject
Next Message Nuchanach Klinjun 1999-09-15 04:21:48 Re: [HACKERS] Permission problem with COPY FROM
Previous Message Clayton Cottingham 1999-09-14 21:53:37 to do's?