Re: Different results between PostgreSQL and Oracle for "for update" statement

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Different results between PostgreSQL and Oracle for "for update" statement
Date: 2020-11-19 15:49:45
Message-ID: 1052083.1605800985@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Borisov 2020-11-19 15:54:54 Re: BUG #16663: DROP INDEX did not free up disk space: idle connection hold file marked as deleted
Previous Message Peter Eisentraut 2020-11-19 15:17:32 Re: Skip ExecCheckRTPerms in CTAS with no data