Re: Update with subselect sometimes returns wrong result - Mailing list pgsql-bugs

From Oliver Seemann
Subject Re: Update with subselect sometimes returns wrong result
Date
Msg-id CANCipfqjL0hcz+3udLumjHinYgSMU7jK93upoZx-dqkYYSEJRw@mail.gmail.com
Whole thread Raw
In response to Re: Update with subselect sometimes returns wrong result  (Andres Freund <andres@2ndquadrant.com>)
Responses Re: Update with subselect sometimes returns wrong result  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-bugs
2013/12/1 Andres Freund <andres@2ndquadrant.com>:
> To get rid of that ambiguity, I suggest rewriting the query to look
> like:
> WITH locked_row AS (
>     SELECT id FROM t1 LIMIT 1 FOR UPDATE
> )
> UPDATE t1 SET id = t1.id
> FROM (SELECT * FROM locked_row) locked
> WHERE t1.id = locked.id
> RETURNING t1.id;

Thanks for looking into this and even providing a workaround!

The patch you posted previously is incomplete, right? Because I can
still trigger the problem with the patch applied on top of git master.
(I use autovacuum_naptime = 1s to reliably trigger within 1-5 seconds).


Oliver

pgsql-bugs by date:

Previous
From: valgog@gmail.com
Date:
Subject: BUG #8647: Backend process hangs and becomes unkillable when SSL client looses connection
Next
From: Andres Freund
Date:
Subject: Re: Update with subselect sometimes returns wrong result