sort by update

From: Sim Zacks <sim(at)compulab(dot)co(dot)il>
To: pgsql-general(at)postgresql(dot)org
Subject: sort by update
Date: 2009-06-11 09:06:41
Message-ID: h0qhf3$be6$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

The following code works to update a table in order with a sequence.
I have tried it on a number of different types of fields.

create temporary sequence seq_1;

update tbl1 set currentsort=nextval('seq_1')
from (select tbl1id from tbl1 order by tbl1id) b
where tbl1.tbl1id=b.tbl1id;

drop sequence seq_1;

My question is, will it always work? In other words is it programmed
that way or is this an unintended feature that might stop working sometime.

Thanks
Sim

Browse pgsql-general by date

  From Date Subject
Next Message Shakil Shaikh 2009-06-11 09:12:22 Array Parameters in EXECUTE
Previous Message David 2009-06-11 08:59:35 When to use cascading deletes?