ED]>
Cc:
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
[EMAIL PROTECTED] 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
[EMAIL PROTECTED] 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 i
<[EMAIL PROTECTED]> writes:
> --WHILE (v_parent_ID IS NOT NULL) LOOP
> -- EXECUTE 'SELECT parent_ID, name FROM akh_build WHERE ID = ' ||
> quote_literal(v_parent_ID) INTO v_row;
> -- return next v_row;
> -- v_parent_ID= v_row.parent_ID;
> --END LOOP;
> FOR v_row IN EXECUTE 'SELECT parent_ID, name
ID |name | parent_ID
-
1a NULL
2b 1
CREATE or REPLACE FUNCTION "public"."get_relation"(
IN "par_fields" text,
IN "par_table" text,
IN "par_id" int4)
RETURNS SETOF "pg_catalog"."record" AS
$BODY$
DECLARE v_parent_ID integer;
DECLARE v_row