X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4535052817 for ; Tue, 21 Jun 2005 07:24:04 -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 22535-09 for ; Tue, 21 Jun 2005 10:23:59 +0000 (GMT) Received: from smtp-send.myrealbox.com (smtp-send.myrealbox.com [192.108.102.143]) by svr1.postgresql.org (Postfix) with ESMTP id 0367D5280D for ; Tue, 21 Jun 2005 07:23:58 -0300 (ADT) Received: from [172.16.1.204] glaesema [61.197.227.146] by smtp-send.myrealbox.com with NetMail SMTP Agent $Revision: 1.5 $ on Linux via secured & encrypted transport (TLS); Tue, 21 Jun 2005 04:24:01 -0600 In-Reply-To: <200506211531.28871.lawgon@thenilgiris.com> References: <200506211531.28871.lawgon@thenilgiris.com> Mime-Version: 1.0 (Apple Message framework v730) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <0352BD99-B517-4D57-808A-924A2D59ADFF@myrealbox.com> Cc: PostgreSQL SQL Content-Transfer-Encoding: 7bit From: Michael Glaesemann Subject: Re: customising serial type Date: Tue, 21 Jun 2005 19:23:57 +0900 To: Kenneth Gonsalves X-Mailer: Apple Mail (2.730) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200506/263 X-Sequence-Number: 21864 On Jun 21, 2005, at 7:01 PM, Kenneth Gonsalves wrote: > in a table with a serial datatype, how do i get the sequence to start > at a specific number like 100000? The SERIAL datatype (e.g., CREATE TABLE foo(foo_id SERIAL) )is a shorthand for something like CREATE SEQUENCE foo_id_seq; CREATE TABLE foo (foo_id integer default nextval('foo_id_seq') ); If you want it to specify the start value, you'll need to either use CREATE SEQUENCE first and then create the table with the appropriate default, or use ALTER SEQUENCE after creating the table. http://www.postgresql.org/docs/8.0/interactive/sql-createsequence.html http://www.postgresql.org/docs/8.0/interactive/sql-altersequence.html Michael Glaesemann grzm myrealbox com