On Friday 09 May 2014 08:36:04 David G Johnston wrote: > This seems to likely be the same, still open, bug reported previously: > > No Number Assigned: > http://www.postgresql.org/message-id/CANCipfpfzoYnOz5jj=UZ70_R=CwDHv36dqWSpw > si27vpm1z5sA@xxxxxxxxxxxxxx > > #8464 > http://www.postgresql.org/message-id/E1VN53g-0002Iy-Il@wrigleys.postgresql.o > rg > > #8470 is referenced in the first thread as well...though that is > specifically a performance issue and not a query bug. > > The recommended work-around is to move the sub-query using the "FOR UPDATE" > into a CTE. Thanks for those pointers, it certainly looks like the same issue (the only difference being the size of the limit) and there has been a good amount of discussion there. I'll try the CTE workaround, although that leaves a bad taste in my mouth. From the discussions in the 1st thread, I wonder wether raising the isolation level to repeatable read would also fix the issue ? In any case, testing will take time because the bug triggers less than once a day and I haven't yet managed to reproduce it locally. ps: sorry I'm only seeing your answer now, it helps if you cc me when answering the list. -- Vincent de Phily