Re: Returning multiple result sets - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: Returning multiple result sets
Date
Msg-id BAY20-F10756838B935AAF25FCD6BF9500@phx.gbl
Whole thread Raw
In response to Re: Returning multiple result sets  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: Returning multiple result sets  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-hackers
> > for my task I need little different form :-(
> >
> > create function a(..) returns setof tables
> >
> > but SQL2003 needs type table, and this can be solution
>
>You want a function return entire tables at a time? Why bother when you
>can just return rows and signal when the next table starts?
>

what is difference between rows with different structures and tables? Tables 
are more logic. But I unlike function which returns setof tables. This need 
data type table. I prefere normal clasic solution.

-------------- stored proc -------------- | --------------- client 
------------------

function -> scalar, vector, table

procedure ->  OUT params
-----------------------------
every free select       --------------------------------> table
-----------------------------

I don't have imagine how I can write readable code with your proposal


variants one:

create function aaa returns setof anyrecord
begin for each a in select * from temptab1   return next a; end loop; return next 'next table'; for each a in select *
fromtemptab2   return next a; end loop; return next 'ok'; return;
 
end;

variants two:
create procedure aaa(OUT allok bool)
begin select * from temptab1; select * from temptab2; a := true;
end;

I don't have better words :-). I am sorry. I don't wont to complicate 
internal structure of planer, executor, etc ... Procedures are different 
than functions, and can be executed different, Isn't possible using 
procedure in params list.

Nice day
Pavel

_________________________________________________________________
Citite se osamele? Poznejte nekoho vyjmecneho diky Match.com. 
http://www.msn.cz/



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Virtual tuple slots versus TOAST: big problem
Next
From: Bruce Momjian
Date:
Subject: Re: MERGE vs REPLACE