Re: How to realize ROW_NUMBER() in 8.3? - Mailing list pgsql-sql

From Andreas Kretschmer
Subject Re: How to realize ROW_NUMBER() in 8.3?
Date
Msg-id 20110504052836.GA5658@tux
Whole thread Raw
In response to Re: How to realize ROW_NUMBER() in 8.3?  (Emi Lu <emilu@encs.concordia.ca>)
List pgsql-sql
Emi Lu <emilu@encs.concordia.ca> wrote:

> Thank you for the info.
>
> I found a simple way:
> ==========================
> [1] create SEQUENCE tmp start 7820;
> [2]
>     insert into desti_table_name
>     select nextval('tmp'),
>            c1, c2... ... cN
>     from t1 left join t2... ... tn
>     where ... ...
>
> Just for people using 8.3, this is mimic row_number.

Not really... you have to reset the sequence after the select, and i'm
not sure about ordering the result.


Andreas
-- 
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."   (unknown)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°


pgsql-sql by date:

Previous
From: Viktor Bojović
Date:
Subject: function timeout
Next
From: Tarlika Elisabeth Schmitz
Date:
Subject: data import via COPY, Rules + Triggers