pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Scott Marlowe <smarlowe@g2switchworks.com>
To: Kris Kiger <kris@musicrebellion.com>
Cc: Pgsql-Admin (E-mail) <pgsql-admin@postgresql.org>
Subject: Re: Very worried about this
Date: Thu, 24 Mar 2005 15:37:44 -0600
Message-ID: <1111700264.12450.10.camel@state.g2switchworks.com> (raw)
In-Reply-To: <42432F48.8060103@musicrebellion.com>
References: <42432F48.8060103@musicrebellion.com>

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.



view thread (7+ messages)  latest in thread

Message-ID: <1111700264.12450.10.camel@state.g2switchworks.com>
Permalink:  ../1111700264.12450.10.camel@state.g2switchworks.com/
Also on:    postgresql.org/message-id/1111700264.12450.10.camel@state.g2switchworks.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: smarlowe@g2switchworks.com, kris@musicrebellion.com
  Subject: Re: Very worried about this
  In-Reply-To: <1111700264.12450.10.camel@state.g2switchworks.com>
  References: <42432F48.8060103@musicrebellion.com> <1111700264.12450.10.camel@state.g2switchworks.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox