Re: [HACKERS] How to implement oracle like rownum(function or seudocolumn)

2006-04-11 Thread Nicolas Barbier
2006/4/8, Tom Lane <[EMAIL PROTECTED]>: > 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-requ

Re: [HACKERS] How to implement oracle like rownum(function or seudocolumn)

2006-04-11 Thread Jim C. Nasby
On Sat, Apr 08, 2006 at 03:04:40PM -0400, Tom Lane wrote: > Jan Wieck <[EMAIL PROTECTED]> 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 op

Re: [HACKERS] How to implement oracle like rownum(function or seudocolumn)

2006-04-08 Thread Christopher Kings-Lynne
I need a rownum column, like Oracle. I have searched the mailing lists and I don't see a satisfactory solution, so I was wondering write a UDF to implement it, the requirements are: +1 I would _love_ to see rownums in PostgreSQL :) Chris ---(end of broadcast)-

Re: [HACKERS] How to implement oracle like rownum(function or seudocolumn)

2006-04-08 Thread Jonah H. Harris
On 4/8/06, David Fetter <[EMAIL PROTECTED]> wrote: > Sadly, ANSI did just that. Thanks for pointing that out... I'd been using LIMIT/OFFSET for so long, I totally forgot about the standard :( -- Jonah H. Harris, Database Internals Architect EnterpriseDB Corporation 732.331.1324

Re: [HACKERS] How to implement oracle like rownum(function or seudocolumn)

2006-04-08 Thread David Fetter
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 th

Re: [HACKERS] How to implement oracle like rownum(function or seudocolumn)

2006-04-08 Thread Jonah H. Harris
On 4/8/06, Tom Lane <[EMAIL PROTECTED]> wrote: > 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; > Yep, the query would have to be rewritten similar to Oracle's: SELECT row

Re: [HACKERS] How to implement oracle like rownum(function or seudocolumn)

2006-04-08 Thread Tom Lane
Jan Wieck <[EMAIL PROTECTED]> 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 outp

Re: [HACKERS] How to implement oracle like rownum(function or seudocolumn)

2006-04-08 Thread Jonah H. Harris
On 4/8/06, Jan Wieck <[EMAIL PROTECTED]> 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 belong

Re: [HACKERS] How to implement oracle like rownum(function or seudocolumn)

2006-04-08 Thread Jan Wieck
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

Re: [HACKERS] How to implement oracle like rownum(function or seudocolumn) ?

2006-04-08 Thread Michael Fuhr
On Sat, Apr 08, 2006 at 12:46:06PM -0400, Tom Lane wrote: > Juan Manuel Diaz Lara <[EMAIL PROTECTED]> writes: > > I need a rownum column, like Oracle. I have searched the mailing lists > > and I don't see a satisfactory solution, so I was wondering write a > > UDF to implement it, the requirements

Re: [HACKERS] How to implement oracle like rownum(function or seudocolumn) ?

2006-04-08 Thread Tom Lane
Juan Manuel Diaz Lara <[EMAIL PROTECTED]> writes: > I need a rownum column, like Oracle. I have searched the mailing lists and I > don't see a satisfactory solution, so I was wondering write a UDF to > implement it, the requirements are: Try keeping a counter in fcinfo->flinfo->fn_extra. > 3.