Stephan Szabo napsal(a):
>>create or replace function foo (integer)
>> returns setof foo as '
>> declare pid alias for $1;
>> declare rec RECORD;
>> BEGIN
>> FOR rec in select * from foo
>> where foo.pid=pid LOOP
>> return next rec;
>> raise warning ''uid=% pid=%'',rec.uid,rec.pid;
>> select into rec * from foo (rec.uid);
>>
>>
>
>Shouldn't you be looping over these results in order to return them,
>something like
> FOR rec2 in select * from foo(rec.uid) LOOP
> return next rec2;
> END LOOP;
>
>Otherwise, why should the results from the other call become results from
>your call (what if you want to process them and not return all of them, or
>what if it's a function with a different type?)
>
>
>
Yes, I understand but I expect that the Postgres will try to do what I
wrote.
In the case of datatype michmach I would expect that the Postgres returns
error as it do in case of
select a:int4 from table1
union all
select b:text from table2;
How Postgres recognizes how was the function called?
How can Postgres recognize the the function is called recursivelly?
I can insert selected rows into temporary table and return them
in the highest level of recursion when I recognized it.
--
email: pbravenec@solartec.cz
telefon: 777 566 384
icq: 227051816