pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Lockhart <lockhart@alumni.caltech.edu>
To: Stéphane FILLON <fillons@offratel.nc>
Cc: pgsql-general <pgsql-general@postgreSQL.org>
Subject: Re: [HACKERS] BUG with UNIQUE clause
Date: Wed, 15 Sep 1999 01:52:43 +0000
Message-ID: <37DEFBEB.8D75D0FB@alumni.caltech.edu> (raw)
References: <000f01befedd$3f26fda0$a6373ad1@portable>

> 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@amgen.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@alumni.caltech.edu
South Pasadena, California



view thread (3+ messages)  latest in thread

Message-ID: <37DEFBEB.8D75D0FB@alumni.caltech.edu>
Permalink:  ../37DEFBEB.8D75D0FB@alumni.caltech.edu/
Also on:    postgresql.org/message-id/37DEFBEB.8D75D0FB@alumni.caltech.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: lockhart@alumni.caltech.edu, fillons@offratel.nc, pgsql-general@postgreSQL.org
  Subject: Re: [HACKERS] BUG with UNIQUE clause
  In-Reply-To: <37DEFBEB.8D75D0FB@alumni.caltech.edu>
  References: <000f01befedd$3f26fda0$a6373ad1@portable> <37DEFBEB.8D75D0FB@alumni.caltech.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox