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

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
Subject: Re: FOR-IN-EXECUTE: FOR does not replanned on each entry to the FOR loop
Date: 2008-03-28 15:43:59
Message-ID: 47ED123F.80404@timbira.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Euler Taveira de Oliveira 2008-03-28 16:43:25 Re: Redundant explicit field name/types description while select from function with return type of record
Previous Message Bruce Momjian 2008-03-28 15:22:46 Re: [PATCHES] Incomplete docs for restore_command for hotstandby