Re: Unique constraint violation on serial column

From: Bill Chandler <billybobc1210(at)yahoo(dot)com>
To: Ragnar "Hafsta" <gnari(at)simnet(dot)is>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Unique constraint violation on serial column
Date: 2005-04-12 14:59:55
Message-ID: 20050412145956.42547.qmail@web51407.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm sorry, was working on little sleep yesterday. You
are right, the table was created with the columns in
the following order:

d1, obj_id, d2, val, correction, delta, evt_id

The insert command looks something like:

INSERT INTO EVENT_TBL VALUES(1039850293991, 145,
1039110343000, '10.25', 1, 739950991)

Bill

--- Ragnar Hafsta <gnari(at)simnet(dot)is> wrote:
> On Mon, 2005-04-11 at 11:03 -0700, Bill Chandler
> wrote:
>
> > ERROR: duplicate key violates unique constraint
> > event_tbl_evt_id_key
>
> > EVENT_TBL
> > evt_id bigserial, unique
> > d1 numeric(13)
> > obj_id numeric(6)
> > d2 numeric(13)
> > val varchar(22)
> > correction numeric(1)
> > delta numeric(13)
>
> and a bit later , in response to a question,
> On Mon, 2005-04-11 at 14:24 -0700, Bill Chandler
> wrote:
> > Tom,
> >
> > This is not the EXACT command (don't have that
> since
> > this a client site and they did not have logging
> > turned on) but the insert command would have
> looked
> > something like:
> >
> > INSERT INTO EVENT_TBL VALUES(1039850293991,
> 'X.Y.Z',
> > 1039110343000, '10.25', 1, 739950991)
>
> firstly, the types do not seem to match the table
> definition.
>
> secondly, you seem to be inserting a literal value
> into your
> serial column.
>
> did you mean to say that the insert was
> INSERT INTO EVENT_TBL (d1,...) VALUES (...) ?
>
> what is the current value of the sequence ?
> are there any rows there evt_id is higher than that
> ?
>
> gnari
>
>
>
>


__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-04-12 15:06:35 Re: client interfaces
Previous Message David Parker 2005-04-12 14:51:09 client interfaces