duplicate key violate error

From: AI Rumman <rummandba(at)gmail(dot)com>
To: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: duplicate key violate error
Date: 2011-06-14 08:30:18
Message-ID: BANLkTik_soP7_Da9kTecJB7HK_1FiOQ09g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I got duplicate key violate error in the db log for the following query:
INSERT INTO tab1 ( SELECT '1611576', '1187865' WHERE NOT EXISTS (
SELECT 1 FROM tab1 WHERE id='1611576' AND id2='1187865' ) )

The error occured during production time.
But when I manually executed the query, it inserted one row with success and
next time it inserted 0 rows.

\d tab1
id int
id2 int
primary key (id,id2)

So, any idea why the error occurred at production time.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Guillaume Lelarge 2011-06-14 08:32:46 Re: HOW TO install or use pageinspect
Previous Message Radosław Smogura 2011-06-14 08:30:03 Proposition fetch cursors