Re: BUG #8448: looping through query results exits at 10th step under some conditions - Mailing list pgsql-bugs

From David Johnston
Subject Re: BUG #8448: looping through query results exits at 10th step under some conditions
Date
Msg-id 1384292093855-5777999.post@n5.nabble.com
Whole thread Raw
In response to Re: BUG #8448: looping through query results exits at 10th step under some conditions  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Re: BUG #8448: looping through query results exits at 10th step under some conditions  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Tom Lane-2 wrote
> 1. Leave the code alone, but document that the prefetching behavior
> exists.
> Users who run into this are on their own to work around it.

1a.  Leave the code alone and expect that occasionally users will encounter
this problem, post to the bugs/general list, and the community helps them
figure out how to overcome the problem in their specific case.

Even though the OPs test case proves the bug exists the fact that it makes
no sense indeed makes it hard to get excited about proactively preventing
this situation.  Convention for updating within a loop is that you'd update
the current record on each iteration - not past or future records (which is
happening implicitly here because of the CROSS JOIN).  A proper update
statement, possibly with a RETURNING clause, is often going to be the better
solution anyway.

So, is there an underlying use-case driving this complaint that should be
considered by the community either to induce a fix to the behavior or just
to solicit suggestions for better alternatives?

David J.




--
View this message in context:
http://postgresql.1045698.n5.nabble.com/BUG-8448-looping-through-query-results-exits-at-10th-step-under-some-conditions-tp5770594p5777999.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #8448: looping through query results exits at 10th step under some conditions
Next
From: Peter Eisentraut
Date:
Subject: Re: BUG #8588: Need work arounds for Apple unaligned access