Re: Cannot insert a duplicate key into unique index - Mailing list pgsql-novice

From Dmitry Tkach
Subject Re: Cannot insert a duplicate key into unique index
Date
Msg-id 3F15AB5E.4090605@openratings.com
Whole thread Raw
In response to Cannot insert a duplicate key into unique index  ("Brian Johnson" <bjohnson@johnson-engineering.ca>)
Responses Re: Cannot insert a duplicate key into unique index  ("Patrick Hatcher" <PHatcher@macys.com>)
Re: Cannot insert a duplicate key into unique index  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
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


pgsql-novice by date:

Previous
From: "Brian Johnson"
Date:
Subject: Cannot insert a duplicate key into unique index
Next
From: "Patrick Hatcher"
Date:
Subject: Re: Cannot insert a duplicate key into unique index