In article <[EMAIL PROTECTED]>,
Lyubomir Petrov <[EMAIL PROTECTED]> writes:
> create sequence seq_tmp;
> select nextval('seq_tmp') as rank, a.id, a.name from (select id, name
> from t order by name desc) a;
> drop sequence seq_tmp;
Using a temporary sequence for that would avoid naming conflicts.
> P.S. I'm sure you can wrap it in plperl stored procedure :)
Yes, prepending the ranking column in the application would be more efficient.
I wonder whether Randall knows Perl? ;-)
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faq