Re: Odd behaviour of SELECT ... ORDER BY ... FOR UPDATE - Mailing list pgsql-hackers

From Etsuro Fujita
Subject Re: Odd behaviour of SELECT ... ORDER BY ... FOR UPDATE
Date
Msg-id 5594EF52.10207@lab.ntt.co.jp
Whole thread Raw
In response to Re: Odd behaviour of SELECT ... ORDER BY ... FOR UPDATE  (Marko Tiikkaja <marko@joh.to>)
Responses Re: Odd behaviour of SELECT ... ORDER BY ... FOR UPDATE  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Hi Marko,

On 2015/07/02 16:27, Marko Tiikkaja wrote:
> On 7/2/15 9:15 AM, Etsuro Fujita wrote:
>> While working on the foreign-join-pushdown issue, I noticed that in READ
>> COMMITTED isolation level it's possible that the result of SELECT ...
>> ORDER BY ... FOR UPDATE is not sorted correctly due to concurrent
>> updates that replaced the sort key columns with new values as shown in
>> the below example.  That seems odd to me.  So, I'd like to propose
>> raising an error rather than returning a possibly-incorrect result for
>> cases where the sorted tuples to be locked were modified by concurrent
>> updates.

> I don't like the idea of READ COMMITTED suddenly throwing errors due to
> concurrency problems.  Using FOR UPDATE correctly is really tricky, and
> this is just one example.  And a documented one, at that, too.

Ah, you are right.  I'll withdraw this.  Sorry for the noise.

Best regards,
Etsuro Fujita



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: pg_basebackup and replication slots
Next
From: Heikki Linnakangas
Date:
Subject: Re: Refactoring speculative insertion with unique indexes a little