Re: Re: "Oracle's ROWNUM" - Mailing list pgsql-general

From Tom Lane
Subject Re: Re: "Oracle's ROWNUM"
Date
Msg-id 11381.996450944@sss.pgh.pa.us
Whole thread Raw
In response to Re: "Oracle's ROWNUM"  (Svenne Krap <usenet@krap.dk>)
List pgsql-general
Svenne Krap <usenet@krap.dk> writes:
> I thought of the possibility to do something like

> select rownum as artistplacement, s.* from (select rownum as
> techplacement, * from ranking order by technical_points) order by
> s.artiste_points

This is an interesting example, but I do not believe that ROWNUM could
really be used that way.  You are assuming that ROWNUM is computed after
the rows are sorted --- but in fact SQL requires the target expressions
of a SELECT to be computed before ORDER BY is applied.  What would you
expect to happen with
    SELECT rownum, * FROM table ORDER BY 1

Does anyone know what the actual semantics of Oracle's ROWNUM are?

            regards, tom lane

pgsql-general by date:

Previous
From: Svenne Krap
Date:
Subject: Re: "Oracle's ROWNUM"
Next
From: Wayne Johnson
Date:
Subject: alter user to change user's password returns pg_shadow: Permission denied.