Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com> writes:
> create table su (a int, b int);
> insert into su values(1, 1);
> - session 1:
> begin;
> update su set b = 2 where b = 1;
> - sess 2:
> select * from su where a in (select a from su where b = 1) for update;
This'd probably work the way you expect if there were "for update"
in the sub-select as well. As is, the sub-select will happily
return "1".
regards, tom lane