Unix Technical Forum

Re: Strange RETURN NEXT behaviour in Postgres 8.0

This is a discussion on Re: Strange RETURN NEXT behaviour in Postgres 8.0 within the pgsql Hackers forums, part of the PostgreSQL category; --> "Sergey E. Koposov" <math@sai.msu.ru> writes: > LOOP > FETCH cur into rec; > RETURN NEXT rec; > EXIT WHEN ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-11-2008, 03:44 AM
Tom Lane
 
Posts: n/a
Default Re: Strange RETURN NEXT behaviour in Postgres 8.0

"Sergey E. Koposov" <math@sai.msu.ru> writes:
> LOOP
> FETCH cur into rec;
> RETURN NEXT rec;
> EXIT WHEN NOT FOUND;
> END LOOP;
> RETURN;


Don't you think you should have the EXIT *above* the RETURN NEXT?
I would expect this to emit a bogus row of nulls after the last row
returned by the cursor. (At least that's what I get with current
sources. Pre-8.0 it might return the last row twice.)

Running it on a 500-million-row table would quite possibly run out of
memory or disk space, too, because RETURN NEXT accumulates all the
results before the function is actually exited.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:34 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com