Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 36F24476028 for ; Wed, 13 Mar 2002 20:01:40 -0500 (EST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id D683AD5F7; Wed, 13 Mar 2002 17:01:39 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id CC0815BFD; Wed, 13 Mar 2002 17:01:39 -0800 (PST) Date: Wed, 13 Mar 2002 17:01:39 -0800 (PST) From: Stephan Szabo To: Hubert Palme Cc: Subject: Re: Line Numbering in SELRCT Output In-Reply-To: Message-ID: <20020313165826.S90759-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200203/174 X-Sequence-Number: 7054 On Mon, 11 Mar 2002, Hubert Palme wrote: > Paul wrote: > > > CREATE SEQUENCE seq1; > > > > SELECT nextval('seq1'), amname FROM pg_am; > > > > DROP SEQUENCE seq1; > > > > Hmm... I forgot to mention that my SELECT statement has an ORDER BY clause. > The sort is done after the sequence numbers being generated. So the order > of the sequence numbers becomes damaged by the sort. > > Is there any hint how to avoid this? select nextval('seq1'), foo.* from (select ...) foo;