Re: Cannot insert a duplicate key into unique index

From: "Brian Johnson" <bjohnson(at)johnson-engineering(dot)ca>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Cannot insert a duplicate key into unique index
Date: 2003-07-16 21:29:33
Message-ID: 20030716.DZl.96438500@192.168.0.1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Well I had to do some voodoo on my redhat machine (enabling syslog facility in
postgresql.conf and then create the syslog facility and restart both services)

But I did get the sql statements to output.

The tip about lang_pkey helped since I could check the source files and found that
the it is not a serial as the primary key but a varchar field

So now I have the sql statement too, and can hunt down the problem

Thanks guys

Patrick Hatcher (PHatcher(at)macys(dot)com) wrote:
>
>
>This same error happened to me this week, and I also saw a posting from
>someone else. By chance, do you have a serial field on your lang_pkey?
>And if you do, have you exported and reimported the table, dropped and
>recreated the table or done something to the serial? I had done this and
>when the table was recreated, it reset my serial counter to 1. I
>eventually butted up against a PK with the same number already on the
>system. You might check there
>
>Patrick Hatcher
>Macys.Com
>
>
>
>
> Dmitry Tkach
> <dmitry(at)openratings(dot)com To: Brian Johnson
<bjohnson(at)johnson-engineering(dot)ca>
> > cc: pgsql-novice(at)postgresql(dot)org
> Sent by: Subject: Re: [NOVICE] Cannot
insert a duplicate key into unique index
> pgsql-novice-owner(at)post
> gresql.org
>
>
> 07/16/2003 12:45 PM
>
>
>
>
>
>Brian Johnson wrote:
>
>>I keep getting this error from a complex, multi-table php app
>>
>>postgres[4513]: [4] ERROR: Cannot insert a duplicate key into unique index
>>lang_pkey
>>
>>To help me find the problem, is there a way to get logging to show what
>table the
>>error is caused by or what SQL code is causing it?
>>
>>
>>Also, from researching this problem on the internet, it look slike the
>unique index
>>would normally have three segments table_field_key .. any idea why this
>one is
>>listed differently?
>>
>>
>>
>PK indexes are different, because there can only be one pkey on a table,
>there is no need for the 'field' part.
>So your index name looks like <tablename>_pkey...
>I guess, this answers your question about 'what table the error is
>caused by'...
>
>As for 'what SQL code', you can set debug_print_query=true in
>postgresql.conf - this will make it print all the sql queries you
>execute to the log file...
>
>I hope, it helps...
>
>Dima
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 7: don't forget to increase your free space map settings
>
>
>
>

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2003-07-16 22:04:27 Re: Cannot insert a duplicate key into unique index
Previous Message Patrick Hatcher 2003-07-16 19:52:54 Re: Cannot insert a duplicate key into unique index