Forum OpenACS Q&A: Response to Postgres feature questions
to compute the comparison between the current row and the previous
row based on some variables you set at the end of each iteration in
your program instead of in the database.
However, if you want or need to do nearly the same thing in postgres
you do in oracle you could try using a postgres sequence to number
create sequence test_data_view_order_seq;
create table test_data_view_order (row_num int, whatever_field
insert into test_data_view_order (row_num,whatever_field)
from (select id from test_data_view order by whatever_field)
Then, in your ugly query, join test_data_view_order to
test_data_view based on whatever_field where whatever_field is the
field you are ordering by. This would be the uglier postgres hack
to replace to ugly oracle hack.