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 2DAB2D1B2E0 for ; Fri, 2 Jul 2004 16:40:13 -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 35520-06 for ; Fri, 2 Jul 2004 19:40:13 +0000 (GMT) Received: from smtp2k.poczta.onet.pl (smtp2k.poczta.onet.pl [213.180.130.34]) by svr1.postgresql.org (Postfix) with ESMTP id 4446CD1B27C for ; Fri, 2 Jul 2004 16:40:10 -0300 (ADT) Received: from pk2.test.onet.pl ([192.168.241.242]:62103 "EHLO pk2.test.onet.pl") by kps2.test.onet.pl with ESMTP id ; Fri, 2 Jul 2004 21:40:03 +0200 Content-Type: multipart/alternative; boundary="----------=_1088797202-12014-1" Content-Transfer-Encoding: binary MIME-Version: 1.0 Received: from 213.180.130.14 by 192.168.240.58 with HTTP; Fri, 02 Jul 2004 21:40:02 +0200 , from 80.55.40.138 by 213.180.130.14 with HTTP Date: Fri, 02 Jul 2004 21:40:02 +0200 From: teknet@poczta.onet.pl To: pgsql-admin@postgresql.org Subject: Re: SERIAL type not autoincremented X-Priority: 3 X-Mailer: onet.poczta In-Reply-To: <200407021131.57987.mike@nachbaur.com> Message-Id: <20040702194010Z137290-15166+26852@kps2.test.onet.pl> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.8 tagged_above=0.0 required=5.0 tests=HTML_20_30, HTML_MESSAGE, NO_REAL_NAME X-Spam-Level: X-Archive-Number: 200407/48 X-Sequence-Number: 14116 This is a multi-part message in MIME format... ------------=_1088797202-12014-1 Content-Type: text/html; charset="iso-8859-2" Content-Disposition: inline Content-Transfer-Encoding: 8bit

i found the problem:

 

sys=> create table test2(
sys(> id serial,
sys(> name varchar(10),
sys(> primary key(id)
sys(> );
NOTICE:  CREATE TABLE will create implicit sequence "test2_id_seq" for "serial" column "test2.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "test2_pkey" for table "test2"
CREATE TABLE
sys=> insert into test2 values(1,'myname');
INSERT 18765 1
sys=> insert into test2 (name) values('myname2');
ERROR:  duplicate key violates unique constraint "test2_pkey"
sys=>

Why is it so ?

 

Thanx

Michal

------------=_1088797202-12014-1 Content-Type: text/plain; charset="iso-8859-2" Content-Disposition: inline Content-Transfer-Encoding: 8bit i found the problem:   sys=> create table test2( sys(> id serial, sys(> name varchar(10), sys(> primary key(id) sys(> ); NOTICE:  CREATE TABLE will create implicit sequence "test2_id_seq" for "serial" column "test2.id" NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "test2_pkey" for table "test2" CREATE TABLE sys=> insert into test2 values(1,'myname'); INSERT 18765 1 sys=> insert into test2 (name) values('myname2'); ERROR:  duplicate key violates unique constraint "test2_pkey" sys=> Why is it so ?   Thanx Michal ------------=_1088797202-12014-1--