Re: Receiving many more rows than expected - Mailing list pgsql-general

From Vincent de Phily
Subject Re: Receiving many more rows than expected
Date
Msg-id 1505308.5GZDhGOHS9@moltowork
Whole thread Raw
In response to Re: Receiving many more rows than expected  (Adrian Klaver <adrian.klaver@aklaver.com>)
Responses Re: Receiving many more rows than expected
List pgsql-general
On Friday 09 May 2014 16:53:49 Adrian Klaver wrote:
> On 05/09/2014 08:04 AM, Vincent de Phily wrote:
> > Thanks to all for taking an interest so far, this bug is... weird.
>
> Yes weird. I tried to replicate your query to see if I could see
> anything similar. Tried it on 9.0.17 and 9.3.4 and could not get it to fail.
>
> Did hard coding the limit value change anything?

I didn't hardcode the formating, just the test to display more debug when the
bug happens:

> if rlen != curs.rowcount or rlen > 5000:
>    LOG.error("Fetched strange number of rows %d %d %s", rlen, curs.rowcount,
>              query)

And I got 2 instances of the bug during the weekend. Annoyingly, the debug
showed as expected that rlen == curs.rowcount and that the query does ask for
5000 records. So the querystring formating is apparently not at fault.

I also verified that none of the returned row ids overlapped (as expected).


So... Still not solved :(


I'm running out of ideas, but there are still two things I want to try:
* Logging all queries on the server side until I catch at least one instance
  of the bug. Is there a way to log the number of rows affected by a query ?
* Create a new cursor for each execute(), in case there somehow is some
  leftover state between two execute() calls. However I did a number of code
  changes today; they should be unrelated but I'll let them run on their own
  for a while to verify that.

--
Vincent de Phily


pgsql-general by date:

Previous
From: Borodin Vladimir
Date:
Subject: Question about synchronous replication
Next
From: David G Johnston
Date:
Subject: Re: Receiving many more rows than expected