Re: Returning multiple result sets

From: "Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com>
To: kleptog(at)svana(dot)org
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Returning multiple result sets
Date: 2005-11-20 17:05:36
Message-ID: BAY20-F10756838B935AAF25FCD6BF9500@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 * from temptab2
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/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message pgsql 2005-11-20 17:21:02 unsubscribe
Previous Message Tom Lane 2005-11-20 16:40:47 Re: Virtual tuple slots versus TOAST: big problem