Re: How to implement oracle like rownum(function or seudocolumn) - Mailing list pgsql-hackers

From David Fetter
Subject Re: How to implement oracle like rownum(function or seudocolumn)
Date
Msg-id 20060408220736.GA19392@fetter.org
Whole thread Raw
In response to Re: How to implement oracle like rownum(function or seudocolumn)  (Jan Wieck <JanWieck@Yahoo.com>)
Responses Re: How to implement oracle like rownum(function or seudocolumn)
List pgsql-hackers
On Sat, Apr 08, 2006 at 02:02:53PM -0400, Jan Wieck wrote:
> Someone correct me if I'm wrong, but I was allways under the impression 
> that Oracle's ROWNUM is a thing attached to a row in the final result 
> set, whatever (possibly random) order that happens to have. Now a) this 
> is something that IMHO belongs into the client or stored procedure code, 
> b) if I am right, the code below will break as soon as an ORDER BY is 
> added to the query and most importantly c) if a) cannot do the job, it 
> indicates that the database schema or business process definition lacks 
> some key/referential definition and is in need of a fix.
> 
> My humble guess is that c) is also the reason why the ANSI didn't find a 
> ROWNUM desirable.

Sadly, ANSI did just that.

http://troels.arvin.dk/db/rdbms/#select-limit
http://troels.arvin.dk/db/rdbms/#select-top-n
http://troels.arvin.dk/db/rdbms/#select-limit-offset

Cheers,
D
-- 
David Fetter <david@fetter.org> http://fetter.org/
phone: +1 415 235 3778        AIM: dfetter666                             Skype: davidfetter

Remember to vote!


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Support Parallel Query Execution in Executor
Next
From: "Jonah H. Harris"
Date:
Subject: Re: Support Parallel Query Execution in Executor