Re: Receiving many more rows than expected

From: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Receiving many more rows than expected
Date: 2014-05-09 15:36:04
Message-ID: 1399649764731-5803406.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Vincent de Phily wrote
> On Friday 09 May 2014 06:52:33 Adrian Klaver wrote:
>> On 05/09/2014 05:36 AM, Vincent de Phily wrote:
>> > On Friday 09 May 2014 07:01:32 Tom Lane wrote:
>> >> Vincent de Phily &lt;

> vincent.dephily@

> &gt; writes:
>> >>> In case it changes anything, this is the uncut (but still anonimized)
>> >>>
>> >>> function:
>> >>> query = """UPDATE foo SET processing = 't' WHERE id IN
>> >>>
>> >>> (SELECT id FROM foo WHERE processing = 'f' ORDER BY id
>> ASC
>> >>> LIMIT %d
>> >>>
>> >>> FOR UPDATE)
>> >>>
>> >>> RETURNING *""" % (conf_getint('DEFAULT', 'push_count',
>> >>> 5000),)
>> >>
>
> Thanks to all for taking an interest so far, this bug is... weird.

This seems to likely be the same, still open, bug reported previously:

No Number Assigned:
http://www.postgresql.org/message-id/CANCipfpfzoYnOz5jj=UZ70_R=CwDHv36dqWSpwsi27vpm1z5sA@mail.gmail.com

#8464
http://www.postgresql.org/message-id/E1VN53g-0002Iy-Il@wrigleys.postgresql.org

#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.

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Receiving-many-more-rows-than-expected-tp5803179p5803406.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Randy Westlund 2014-05-09 20:11:51 Re: Enforce Symmetric Matrix
Previous Message Vincent de Phily 2014-05-09 15:14:25 Re: Receiving many more rows than expected