The following bug has been logged online:
Bug reference: 1304
Logged by: Brendan Fagan
Email address: bfagan@harthosp.org
PostgreSQL version: 7.3.6
Operating system: RedHat ES 3
Description: update does not honor order of subselect
Details:
SQL Update command does not follow the order of a WHERE field IN subselect.
In the following code, I try to reset the order of rows in a column by
updating an order field. Update does not honor the order of output form the
subselect.
create temp sequence foo increment 1 minvalue 0 start 0;
select setval('foo', 0);
update nav_content_structure
set nav_cannister_ord_num = nextval('foo')
where nav_content_id in (
select s.nav_content_id
from nav_content_structure s,
nav_content c
where s.nav_content_tie_id = 2624
and s.nav_cannister_id is not null
and c.nav_content_id = s.nav_content_id
order by s.nav_cannister_id, c.nav_content_title )
and nav_content_tie_id = 2624