Re: Unique constraint violation on serial column

From: Bill Chandler <billybobc1210(at)yahoo(dot)com>
To: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
Cc: Ragnar "Hafsta" <gnari(at)simnet(dot)is>, pgsql-general(at)postgresql(dot)org
Subject: Re: Unique constraint violation on serial column
Date: 2005-04-12 15:58:41
Message-ID: 20050412155841.66161.qmail@web51407.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)dcc(dot)uchile(dot)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[(at)]dcc(dot)uchile(dot)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/

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2005-04-12 16:04:08 Re: Unique constraint violation on serial column
Previous Message Alvaro Herrera 2005-04-12 15:56:01 Re: Unique constraint violation on serial column