Skip site navigation (1) Skip section navigation (2)

Re: FOR-IN-EXECUTE: FOR does not replanned on each entry to the FOR loop

From: <Eugen(dot)Konkov(at)aldec(dot)com>
To: "Euler Taveira de Oliveira" <euler(at)timbira(dot)com>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: FOR-IN-EXECUTE: FOR does not replanned on each entry to the FOR loop
Date: 2008-03-28 17:11:06
Message-ID: 039601c890f6$b6945c70$1200a8c0@kharkov.localhost (view raw or flat)
Thread:
Lists: pgsql-bugs
Sorry, docs have confusing me.
I think 'each entry' means each iterations of loop. So maybe it is need to 
fix doc. to describe for-in-execute more clearly

thx
----- Original Message ----- 
From: "Euler Taveira de Oliveira" <euler(at)timbira(dot)com>
To: <Eugen(dot)Konkov(at)aldec(dot)com>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Sent: Friday, March 28, 2008 5:43 PM
Subject: Re: [BUGS] FOR-IN-EXECUTE: FOR does not replanned on each entry to 
the FOR loop


> Eugen(dot)Konkov(at)aldec(dot)com wrote:
>
>> FOR and WHILE results differ
>> WHILE returns two rows
>> but FOR returns only one.
>> and it seems that FOR does not replanned on each entry to the FOR loop
>> While docs says:
>> 38.6.4. Looping Through Query Results
>> ....
>> This is like the previous form, except that the source query is specified 
>> as a string expression, which is evaluated and replanned on each entry to 
>> the FOR loop
>>
> You are confusing things. The statement above talks about FOR rec IN 
> EXECUTE query_string LOOP ... END LOOP. There is no WHILE.
> When you're using WHILE, the EXECUTE is actually evaluated inside the loop 
> and not in the loop condition (that's why you're seeing another 
> iteration).
>
>
> -- 
>   Euler Taveira de Oliveira
>   http://www.timbira.com/ 


In response to

pgsql-bugs by date

Next:From: Eugen.KonkovDate: 2008-03-28 17:22:51
Subject: ERROR: RETURN NEXT must specify a record or row variable in function returning tuple
Previous:From: Eugen.KonkovDate: 2008-03-28 17:06:21
Subject: Re: BUG: wrong doc or wrong connectby?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group