Re: Receiving many more rows than expected

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Receiving many more rows than expected
Date: 2014-05-10 02:58:48
Message-ID: 536D95E8.10400@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 05/09/2014 08:36 AM, David G Johnston wrote:
> 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

I ran Olivers pgbug.py against 9.0.17 and 9.3.4 and can confirm that I
see the same error. When I turned off autovacuum on 9.3 I did not see
the error which also confirms Olivers observation. Then I rewrote the
program as a plpythonu function and ran it in the 9.0.17 instance. It
ran successfully. It would seem this is either a psycopg2 issue or a
client/server connection problem. Still trying to figure where to go
from here.

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

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2014-05-10 23:09:11 Re: SSL Compression - doesn't work?
Previous Message Tim van der Linden 2014-05-10 01:31:02 Re: Full text: Ispell dictionary