Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id BD94A9FB264 for ; Thu, 19 Oct 2006 13:50:26 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 24788-05 for ; Thu, 19 Oct 2006 13:50:17 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 8F2F99FA5D8 for ; Thu, 19 Oct 2006 13:50:17 -0300 (ADT) Received: by noel.decibel.org (Postfix, from userid 1001) id C4DB156456; Thu, 19 Oct 2006 11:50:16 -0500 (CDT) Received: (hashcash-sendmail, from uid 1001); Thu, 19 Oct 2006 11:50:15 -0500 Date: Thu, 19 Oct 2006 11:50:15 -0500 From: "Jim C. Nasby" To: Indira Muthuswamy Cc: pgsql-sql@postgresql.org Subject: Re: [HACKERS] Bug? Message-ID: <20061019165015.GH71084@nasby.net> References: <20061018184346.GG85041@nasby.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 6.1-RELEASE-p10 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.13 (2006-08-11) X-Hashcash: 1:20:061019:indumuthu@gmail.com::me/fobAtF4IgSzrC:000000000000000000 0000000000000000000000000BGZ X-Hashcash: 1:20:061019:pgsql-sql@postgresql.org::223JvxZgBlzyJl+3:0000000000000 0000000000000000000000001HZw X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.044 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200610/179 X-Sequence-Number: 26568 See section 9.12 of the docs. On Thu, Oct 19, 2006 at 12:28:58PM +0530, Indira Muthuswamy wrote: > Then how do we clear the values of a serial column(is it done only by > dropping the column?)? > > Regards, > M.Indira > > > > On 10/19/06, Jim C. Nasby wrote: > > > >Moving to -sql. > > > >On Wed, Oct 18, 2006 at 06:53:46PM +0530, Indira Muthuswamy wrote: > >> Hai, > >> > >> I have encountered a problem with PostgreSQL.I have created a table > >> 'tab1' with a column 'a' with serial type.I entered 20 records into the > >> table.So the query > >> select max(a) from tab1; > >> returned 20.When I tried the same query after the command > >> truncate table tab1; > >> I found that the output of the first query as > >> > >> max > >> ----- > >> > >> (1 row) > >> When I tried to insert a new row into the table tab1 I found that the > >> value at column a incremented to the value 21. > >> But I heard from my friends that the value of the serial column gets > >> decremented whenever we issue the 'truncate table' command (in MS SQL > >> SERVER).Is the concept same with PostgreSQL or not?Can anyone clarify me > >on > >> this? > > > >Your friends are mistaken. TRUNCATE does nothing to affect sequences. > >-- > >Jim Nasby jim@nasby.net > >EnterpriseDB http://enterprisedb.com 512.569.9461 (cell) > > -- Jim Nasby jim@nasby.net EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)