Re: Re: "Oracle's ROWNUM"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Svenne Krap <usenet(at)krap(dot)dk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Re: "Oracle's ROWNUM"
Date: 2001-07-29 23:55:44
Message-ID: 11381.996450944@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Svenne Krap <usenet(at)krap(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Wayne Johnson 2001-07-30 02:22:12 alter user to change user's password returns pg_shadow: Permission denied.
Previous Message Svenne Krap 2001-07-29 22:47:35 Re: "Oracle's ROWNUM"