Skip site navigation (1) Skip section navigation (2)

Re: Cannot insert a duplicate key into unique index

From: "V i s h a l Kashyap (at) [Sai Hertz And Control Systems]" <sank89(at)sancharnet(dot)in>
To: adelaide(at)zedemail(dot)ca
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Cannot insert a duplicate key into unique index
Date: 2004-02-29 06:07:11
Message-ID: 4041818F.3060700@sancharnet.in (view raw or flat)
Thread:
Lists: pgsql-novice
Dear Adelaide  ,

>Warning: PostgreSQL query failed: ERROR: Cannot insert a duplicate key
>into unique index fee_uk
>  
>
Check the max value in data base for the same index key and then check if
the max value agree with the sequence .
do some thing like
<code>
select max(fees.fee_id);
then
select nextval('general_seq'::text);
</code>
on psql command prompt
Now if the max value of  fees.fee_id
is greater than what  nextval returns
then this sequence has to be fixed

Have you recently done an dump restore ?

-- 
Best Regards,
Vishal Kashyap
Director / Lead Developer,
Sai Hertz And Control Systems Pvt Ltd,
http://saihertz.rediffblogs.com
Jabber IM: vishalkashyap(at)jabber(dot)org
ICQ :      264360076
-----------------------------------------------
You yourself, as much as anybody in the entire 
universe, deserve your love and affection.
- Buddha
---------------
I am usually called by the name Vishal Kashyap
and my Girlfriend calls me Vishal CASH UP.
This is because everyone loves me as Vishal Kashyap
and my Girlfriend loves me as CASH.
                    ___
                   //\\\
                  ( 0_0 )
----------------o0o-----o0o---------------------


In response to

pgsql-novice by date

Next:From: Markus BertheauDate: 2004-02-29 09:50:37
Subject: Re: pg_dumpall and convert from LATIN1 to UTF-8?
Previous:From: Tom LaneDate: 2004-02-29 04:00:56
Subject: Re: help with COPY query

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group