X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id ECED2D1B95E for ; Mon, 22 Sep 2003 05:12:13 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 50395-01 for ; Mon, 22 Sep 2003 02:11:42 -0300 (ADT) Received: from rock.spider.ru (rock.spider.ru [62.183.34.226]) by svr1.postgresql.org (Postfix) with ESMTP id 240BFD1B553 for ; Mon, 22 Sep 2003 02:11:41 -0300 (ADT) Received: from rock (localhost [127.0.0.1]) by rock (Postfix) with SMTP id ED892912B7 for ; Mon, 22 Sep 2003 09:11:39 +0400 (MSD) Received: from sad.localnet.ru (sad.localnet.ru [10.0.0.33]) by rock.spider.ru (Postfix) with ESMTP id A22409122E for ; Mon, 22 Sep 2003 09:11:39 +0400 (MSD) Content-Type: text/plain; charset="koi8-r" From: sad Organization: IT To: pgsql-sql@postgresql.org Subject: Re: auto_increment Date: Mon, 22 Sep 2003 09:15:04 +0400 User-Agent: KMail/1.4.3 References: <008501c37f35$832e26e0$1f00a8c0@middinkcomp> <1064038995.5359.70.camel@linda.lfix.co.uk> In-Reply-To: <1064038995.5359.70.camel@linda.lfix.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200309220915.04899.sad@bankir.ru> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/240 X-Sequence-Number: 15218 On Saturday 20 September 2003 10:23, you wrote: > On Sat, 2003-09-20 at 06:10, Muhyiddin A.M Hayat wrote: > > How to Create auto_increment field in PostreSQL. > > Can I create them using Trigger. > > Use the SERIAL datatype. See also the functions nextval(), currval() > and setval(). I believe it is better to EXPLICITLY declare a SEQUENCE and=20 set the default value nextval() to the field.