Re: Line Numbering in SELRCT Output

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Hubert Palme <hubert(dot)palme(at)web(dot)de>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Line Numbering in SELRCT Output
Date: 2002-03-14 01:01:39
Message-ID: 20020313165826.S90759-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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;

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Christopher Kings-Lynne 2002-03-14 01:27:25 Re:
Previous Message Tom Lane 2002-03-13 22:10:55 Re: Casting