X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id CC7399FA279 for ; Fri, 26 May 2006 11:23:02 -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 53164-04 for ; Fri, 26 May 2006 11:22:57 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from r1.mycybernet.net (r1.mycybernet.net [209.5.206.8]) by postgresql.org (Postfix) with ESMTP id 76D4D9F9B01 for ; Fri, 26 May 2006 11:22:57 -0300 (ADT) Received: from 227-54-222-209.mycybernet.net ([209.222.54.227]:38478 helo=phlogiston.dydns.org) by r1.mycybernet.net with esmtp (Exim 4.50 (FreeBSD)) id 1FjdDL-0005s1-D2; Fri, 26 May 2006 10:22:55 -0400 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id D2D0B417B; Fri, 26 May 2006 10:22:54 -0400 (EDT) Date: Fri, 26 May 2006 10:22:54 -0400 From: Andrew Sullivan To: pgsql-sql@postgresql.org Cc: Bruno Wolff III , Andrew Sullivan Subject: Re: PLEASE help ME , HOW TO GENERATE PRIMARY Keys on the fly Message-ID: <20060526142254.GB5939@phlogiston.dyndns.org> References: <20060526101207.5C4B35B0B83@svr4.postgresql.org> <20060526105037.GB5492@phlogiston.dyndns.org> <20060526140820.GA17450@wolff.to> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060526140820.GA17450@wolff.to> User-Agent: Mutt/1.5.9i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/194 X-Sequence-Number: 25225 On Fri, May 26, 2006 at 09:08:20AM -0500, Bruno Wolff III wrote: > > Rollbacks will not reset sequence values. Use setval to do that. No, what I posted was the CREATE SEQUENCE after the BEGIN. ROLLBACK gets rid of the sequence. The next time you create the same sequence, therefore, it also starts at 1. I don't actually know what this ranking is useful for, to be honest, but people ask for it, and this is a stupid Postgres trick that can make it happen. A -- Andrew Sullivan | ajs@crankycanuck.ca The plural of anecdote is not data. --Roger Brinner