Re: Returning multiple result sets

Lists: pgsql-hackers
From: "Magnus Hagander" <mha(at)sollentuna(dot)net>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Martijn van Oosterhout" <kleptog(at)svana(dot)org>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Returning multiple result sets
Date: 2005-11-20 21:01:24
Message-ID: 6BCB9D8A16AC4241919521715F4D8BCE92E87D@algol.sollentuna.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> > On Sun, Nov 20, 2005 at 11:29:39AM -0500, Tom Lane wrote:
> >> That only works if the caller is prepared to read each result
> >> serially, and not (say) a row at a time in parallel.
>
> > Urk! I don't think anyone is suggesting that resultsets can be
> > interleaved.
>
> No? If not, why not? The main reason why this is being
> pushed, IIRC, is the claim that "you can do this easily in
> other databases". If you don't want to support interleaved
> retrieval of multiple datasets, you had better be prepared to
> prove that no other popular database can do it either.

FWIW, MSSQL used to do only multiple sequential resultsets (from stored
procs, or semicolon separated statements). With SQL 2005, they added
interleaved ones - see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql90
/html/MARSinSQL05.asp (loads of details both about how it was before and
how it is in 2005)

//Magnus


From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Magnus Hagander <mha(at)sollentuna(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Returning multiple result sets
Date: 2005-11-20 21:41:42
Message-ID: 20051120214139.GH32031@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, Nov 20, 2005 at 10:01:24PM +0100, Magnus Hagander wrote:
> FWIW, MSSQL used to do only multiple sequential resultsets (from stored
> procs, or semicolon separated statements). With SQL 2005, they added
> interleaved ones - see
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql90
> /html/MARSinSQL05.asp (loads of details both about how it was before and
> how it is in 2005)

I saw that page but my understanding of it is that you are now allowed
to submit a new query without reading all the results of the last one.
And that subsequent reading of results may be interleaved.

What it doesn't do is allow a single query to return multiple results
sets in an interleaved order.

What I'm trying to say is that the client can't read the results of a
function in any other order than it calls RETURN NEXT. OTOH, if the
server returns a cursor handle, the client can read the cursors in any
order it chooses.

Is this clear, or am I just confusing people (including possibly
myself)?

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.