Re: How to implement oracle like rownum(function or seudocolumn)
От | Tom Lane |
---|---|
Тема | Re: How to implement oracle like rownum(function or seudocolumn) |
Дата | |
Msg-id | 25474.1144523080@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: How to implement oracle like rownum(function or seudocolumn) (Jan Wieck <JanWieck@Yahoo.com>) |
Ответы |
Re: How to implement oracle like rownum(function or seudocolumn)
Re: How to implement oracle like rownum(function or seudocolumn) Re: How to implement oracle like rownum(function or seudocolumn) |
Список | pgsql-hackers |
Jan Wieck <JanWieck@Yahoo.com> writes: > My humble guess is that c) is also the reason why the ANSI didn't find a > ROWNUM desirable. I've never understood what the conceptual model is for Oracle's rownum. Where along the SQL operational pipeline (FROM / WHERE / GROUP BY / aggregate / compute output columns / ORDER BY) is it supposed to be computed? To be useful for the often-requested purpose of nicely labeling output with line numbers, it'd have to be assigned post-ORDER-BY, but then it doesn't make any sense at all to use it in WHERE, nor in sub-selects. A function implemented as per Michael's example would not give the results that I think people would expect for SELECT rownum(), * FROM foo ORDER BY whatever; unless the planner chances to do the ordering with an indexscan. If it does it with a sort step then the rownums will be computed before sorting :-( regards, tom lane
В списке pgsql-hackers по дате отправления: