Re: Unique constraint violation on serial column - Mailing list pgsql-general

From Bill Chandler
Subject Re: Unique constraint violation on serial column
Date
Msg-id 20050412155841.66161.qmail@web51407.mail.yahoo.com
Whole thread Raw
In response to Unique constraint violation on serial column  (Bill Chandler <billybobc1210@yahoo.com>)
Responses Re: Unique constraint violation on serial column  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
List pgsql-general
I did not intend to put explicit values in the
'evt_id' column.  I thought the six values in the
insert command correspond to the 1st six columns in
the create table command, namely d1, obj_id, d2, val,
correction and delta and 'evt_id' is set to the
nextval() automagically.  Is that not correct?

Bill

--- Alvaro Herrera <alvherre@dcc.uchile.cl> wrote:
> On Tue, Apr 12, 2005 at 07:59:55AM -0700, Bill
> Chandler wrote:
> > 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)
>
> So you are indeed inserting constant values in your
> serial field.  (Bad
> idea.)  Why are you doing that (i.e. why aren't you
> using nextval()),
> and do you have numbers bigger than the sequence's
> current value already
> in the table?
>
> --
> Alvaro Herrera (<alvherre[@]dcc.uchile.cl>)
> "Uno combate cuando es necesario... �no cuando est�
> de humor!
> El humor es para el ganado, o para hacer el amor, o
> para tocar el
> baliset.  No para combatir."  (Gurney Halleck)
>



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

pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Unique constraint violation on serial column
Next
From: Alvaro Herrera
Date:
Subject: Re: Unique constraint violation on serial column