Re: SERIAL type not autoincremented

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: teknet(at)poczta(dot)onet(dot)pl
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: SERIAL type not autoincremented
Date: 2004-07-02 18:21:09
Message-ID: 20040702182109.GB31625@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Fri, Jul 02, 2004 at 19:22:17 +0200,
teknet(at)poczta(dot)onet(dot)pl wrote:
> Hello
> i have:
> create table student(
> id SERIAL NOT NULL,
> name VARCHAR(35) NOT NULL,
> primary key (id)
> );
>
> and when i try to insert like this:
> insert into student (name) values('me');
> i receive error:
> ERROR: duplicate key violates unique constraint "student_pkey"
>
> Why ? Do i understeand correctly that SERIAL == AUTO_INCREMENT ?
> As far as i remember i used such type in the past and had no problem.
> What do i miss ?

You probably manually changed the value of the sequence student_id_seq.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Michael A Nachbaur 2004-07-02 18:31:57 Re: SERIAL type not autoincremented
Previous Message Jim Seymour 2004-07-02 18:09:34 Re: SERIAL type not autoincremented