Cannot insert a duplicate key into unique index

From: Adelaide Yip <adelaide(at)zedemail(dot)ca>
To: pgsql-novice(at)postgresql(dot)org
Subject: Cannot insert a duplicate key into unique index
Date: 2004-02-25 17:00:39
Message-ID: 1077728439.4390.10.camel@blownt.millwoods.compeng.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi,

I get the following error when I try to insert into the table fees, even
when the primary and unique key are serial:

Warning: PostgreSQL query failed: ERROR: Cannot insert a duplicate key
into unique index fee_uk

INSERT INTO fees (registrar_name) VALUES ('blah');

Table 'fees'

Attribute | Type | Modifier

--------------------+---------------+-----------------------------------------------
fee_id | numeric(12,0) | not null default
nextval('general_seq'::text)
registrar_name | varchar(30) | not null

Indices: fee_pk,
fee_uk

I don't understand why I get this error when the fee_id column is serial
by default. How can I fix this error? And, how can I display what
value "nextval('general_seq'::text)" returns?

Thanks in advance,
Adelaide

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message CoL 2004-02-27 10:39:11 Re: pg_dumpall and convert from LATIN1 to UTF-8?
Previous Message tully 2004-02-25 15:36:38 Column Headings using Comment?