X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 409FCD1B528 for ; Fri, 2 Jul 2004 15:10:25 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 91899-03 for ; Fri, 2 Jul 2004 18:10:17 +0000 (GMT) Received: from jimsun.linxnet.com (jimsun.linxnet.com [64.32.196.134]) by svr1.postgresql.org (Postfix) with ESMTP id 98592D1B430 for ; Fri, 2 Jul 2004 15:09:52 -0300 (ADT) Received: by jimsun.linxnet.com (Postfix, from userid 332) id 4DEA4430E; Fri, 2 Jul 2004 14:09:34 -0400 (EDT) To: pgsql-admin@postgresql.org Subject: Re: SERIAL type not autoincremented X-Sun-Charset: US-ASCII Reply-To: pgsql-admin@postgresql.org In-Reply-To: <20040702172227Z4873738-14310+28550@kps5.test.onet.pl> Message-Id: <20040702180934.4DEA4430E@jimsun.linxnet.com> Date: Fri, 2 Jul 2004 14:09:34 -0400 (EDT) From: jseymour@linxnet.com (Jim Seymour) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200407/44 X-Sequence-Number: 14112 teknet@poczta.onet.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" You must be leaving something out of the story... $ psql Password: Welcome to psql 7.4.2, the PostgreSQL interactive terminal. ... jseymour=# create table student( jseymour(# id SERIAL NOT NULL, jseymour(# name VARCHAR(35) NOT NULL, jseymour(# primary key (id) jseymour(# ); NOTICE: CREATE TABLE will create implicit sequence "student_id_seq" for "serial" column "student.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "student_pkey" for table "student" CREATE TABLE jseymour=# insert into student (name) values('me'); INSERT 8776502 1 jseymour=# insert into student (name) values('me'); INSERT 8776503 1 jseymour=# insert into student (name) values('me'); INSERT 8776504 1 jseymour=# select * from student; id | name ----+------ 1 | me 2 | me 3 | me (3 rows) Seems to work here. Jim