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 B6A93D1B20E for ; Tue, 6 Jul 2004 01:57:53 -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 90694-02 for ; Tue, 6 Jul 2004 04:57:53 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id C796AD1B1F8 for ; Tue, 6 Jul 2004 01:57:50 -0300 (ADT) Received: (qmail 13872 invoked by uid 500); 6 Jul 2004 05:04:39 -0000 Date: Tue, 6 Jul 2004 00:04:39 -0500 From: Bruno Wolff III To: Markus Bertheau Cc: teknet@poczta.onet.pl, pgsql-admin@postgresql.org Subject: Re: standard IDENTITY support (Was: Re: SERIAL type not autoincremented) Message-ID: <20040706050439.GA13797@wolff.to> Mail-Followup-To: Markus Bertheau , teknet@poczta.onet.pl, pgsql-admin@postgresql.org References: <20040702172227Z4873738-14310+28550@kps5.test.onet.pl> <1088984555.2767.16.camel@teetnang> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1088984555.2767.16.camel@teetnang> User-Agent: Mutt/1.5.6i 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/66 X-Sequence-Number: 14134 On Mon, Jul 05, 2004 at 01:42:35 +0200, Markus Bertheau wrote: > ?? ??????, 02.07.2004, ?? 19:22, teknet@poczta.onet.pl ??????????: > > 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" > > Is this scenario possible in standard SQL identity columns? From what I > read here[1], a standard IDENTITY column can guarantee successful > insertion of a unique key. Is there similar support planned for > PostgreSQL? I don't expect things are going to change. However it isn't a problem if you always use DEFAULT to generate the value to be inserted and that you use bigserial if you need more than 2 billion (2^31) values.