X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CF5E752A37 for ; Thu, 24 Mar 2005 21:37:50 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 76942-09 for ; Thu, 24 Mar 2005 21:37:45 +0000 (GMT) Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by svr1.postgresql.org (Postfix) with ESMTP id 809B85294A for ; Thu, 24 Mar 2005 21:37:44 +0000 (GMT) Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP with MS-WebStorage 6.5.6944 Received: from state.g2switchworks.com by mail.g2switchworks.com; 24 Mar 2005 15:37:44 -0600 Subject: Re: Very worried about this From: Scott Marlowe To: Kris Kiger Cc: "Pgsql-Admin (E-mail)" In-Reply-To: <42432F48.8060103@musicrebellion.com> References: <42432F48.8060103@musicrebellion.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1111700264.12450.10.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Thu, 24 Mar 2005 15:37:44 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/406 X-Sequence-Number: 16904 On Thu, 2005-03-24 at 15:21, Kris Kiger wrote: > I have a table that looks like this: > > Table "public.hd" > Column | Type > | Modifiers > -------------------+-----------------------------+------------------------------------------------------------------------- > d_id | integer | not null default > nextval('public.hd_d_id_seq'::text) > h_id | integer | not null > src | text | > p_q | integer | not null default 1 > c_id | integer | not null > insert_time | timestamp without time zone | default now() > Indexes: > "hd_pkey" PRIMARY KEY, btree (d_id) > "hd_idx" btree (h_id, c_id) > > > _Log output:_ > > [2005-03-24 15:33:25 EST - 13882 - dbname - 4052774] LOG: statement: > INSERT INTO hd (c_id, h_id, p_q) VALUES ((SELECT c_id FROM c WHERE e_id > = 'tester1'), (SELECT h_id FROM h JOIN c USING (c_id) WHERE e_id = > 'tester1' AND h.active AND NOT p_c),10); > > [2005-03-24 15:33:25 EST - 13882 - dbname - 4052774] ERROR: duplicate > key violates unique constraint "hd_pkey" > > > These inserts are being executed ever 1.5 seconds on this database. > This error does not happen often and appears to happen randomly. No > other inserts are being executed on this table except this one. From > our current tests 99% of the inserts go through, with the exception of > these few. Honestly, I don't see how this could be caused from > something on my end. The primary key value is being determined by a > default, so everything should be handled within the database. I'm using > postgres 8.0.1. Any ideas? Are you sure someone hasn't been messing with your sequence some how? That's the only way I've seen these kinds of things happen before.