BUG #1304: update does not honor order of subselect

Started by PostgreSQL Bugs Listover 21 years ago2 messagesbugs
Jump to latest
#1PostgreSQL Bugs List
pgsql-bugs@postgresql.org

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

#2Peter Eisentraut
peter_e@gmx.net
In reply to: PostgreSQL Bugs List (#1)
Re: BUG #1304: update does not honor order of subselect

PostgreSQL Bugs List wrote:

SQL Update command does not follow the order of a WHERE field IN
subselect.

What could possibly have given you the idea that it should?

--
Peter Eisentraut
http://developer.postgresql.org/~petere/