pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Hubert Palme <hubert.palme@web.de>
Cc: pgsql-sql@postgresql.org
Subject: Re: Line Numbering in SELRCT Output
Date: Mon, 18 Mar 2002 14:51:24 -0800 (PST)
Message-ID: <20020318144733.E11746-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <15510.26490.674496.640496@palme-pc.urz.Uni-Wuppertal.DE>

On Mon, 18 Mar 2002, Hubert Palme wrote:

> >>>>> "S" == Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
>
>  S> 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?
>
>  S> select nextval('seq1'), foo.* from (select ...) foo;
>
> I tried this:
>
>CREATE SEQUENCE z_nummer;
>SELECT nextval('z_nummer'), hilfstab.name, hilfstab.vorname
>FROM (SELECT *
>     FROM leute
>      ORDER BY name, vorname) hilfstab;
> DROP SEQUENCE z_nummer;
>
> and got this result:
>
> mitglieder=> \i selorder.sql
> CREATE
> psql:selorder.sql:5: ERROR:  parser: parse error at or near "select"
> DROP
> mitglieder=>
>
> Did I understand you right, this kind of subqueries in FROM clauses
> are allowed?  (Didn't find it in any manual)

What version are you using?
AFAIK that structure is allowed in 7.1 and after.




view thread (5+ messages)

Message-ID: <20020318144733.E11746-100000@megazone23.bigpanda.com>
Permalink:  ../20020318144733.E11746-100000@megazone23.bigpanda.com/
Also on:    postgresql.org/message-id/20020318144733.E11746-100000@megazone23.bigpanda.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sszabo@megazone23.bigpanda.com, hubert.palme@web.de
  Subject: Re: Line Numbering in SELRCT Output
  In-Reply-To: <20020318144733.E11746-100000@megazone23.bigpanda.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox