Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id C4F9D9FB2C8 for ; Thu, 19 Oct 2006 03:59:05 -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 15032-02 for ; Thu, 19 Oct 2006 03:59:00 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nz-out-0102.google.com (nz-out-0102.google.com [64.233.162.204]) by postgresql.org (Postfix) with ESMTP id 0B1229FB2AC for ; Thu, 19 Oct 2006 03:58:59 -0300 (ADT) Received: by nz-out-0102.google.com with SMTP id i11so225086nzi for ; Wed, 18 Oct 2006 23:58:59 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=Y+JkG/wkPXqDzIwEdgxVfBdq/3tfP+TvwH/VKC+f0s1IDzHssp7iTd2uLoMn+2CeTodkwE5l3SG43xER1+BIRS3wV35+MRTfJJGYji/12ltVCyh6iaLclGIq/zN2ukOAMAiBaL6QOsIzw1nc2fP77ZF6UVZEh5kHJNvThxz7fr0= Received: by 10.65.176.3 with SMTP id d3mr383448qbp; Wed, 18 Oct 2006 23:58:59 -0700 (PDT) Received: by 10.65.160.18 with HTTP; Wed, 18 Oct 2006 23:58:58 -0700 (PDT) Message-ID: Date: Thu, 19 Oct 2006 12:28:58 +0530 From: "Indira Muthuswamy" To: "Jim C. Nasby" Subject: Re: [HACKERS] Bug? Cc: pgsql-sql@postgresql.org In-Reply-To: <20061018184346.GG85041@nasby.net> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_91635_10733181.1161241138975" References: <20061018184346.GG85041@nasby.net> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.696 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, HTML_40_50, HTML_MESSAGE, SPF_PASS X-Spam-Level: X-Archive-Number: 200610/186 X-Sequence-Number: 26575 ------=_Part_91635_10733181.1161241138975 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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) > ------=_Part_91635_10733181.1161241138975 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
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 <jim@nasby.net> 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)

------=_Part_91635_10733181.1161241138975--