Re: SQL-Invoked Procedures for 8.1 - Mailing list pgsql-hackers

From Gavin Sherry
Subject Re: SQL-Invoked Procedures for 8.1
Date
Msg-id Pine.LNX.4.58.0410030013160.30323@linuxworld.com.au
Whole thread Raw
In response to Re: SQL-Invoked Procedures for 8.1  (Joe Conway <mail@joeconway.com>)
List pgsql-hackers
On Thu, 23 Sep 2004, Joe Conway wrote:

> Gavin Sherry wrote:
> > Do you have any idea about databases returning result sets from SQL
> > procedures (ie, not functions).
> >
>
> As other's have pointed out, this is very common in the MS SQL Server
> world (and I believe Sysbase also supports it). It works like:
>
> <begin proc def>
>
> select * from something
> ...
> select * from somethingelse
> ...
>
> <end proc def>
>
> We get requests for this kind of functionality at least a couple of
> times a month, and although it's been a few years since I mucked with
> MSSQL, I found it to be very useful in a number of different circumstances.

That's fairly bizarre (at least to my view of the world). Say we could
have OUT parameters which were of some SETOF style type I think that would
solve the same problem.

If we wanted to just return the data as if a SELECT had been issued there
might be some tricky issues for clients like psql of the row descriptor
changed (more rows, new types, etc). On the server side, though, it should
be as simple as reinitialising the destination receiver -- although I
haven't looked at it that closely yet.

Gavin


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Mislabeled timestamp functions (was Re: [SQL] [NOVICE] date_trunc'd timestamp index possible?)
Next
From: Gavin Sherry
Date:
Subject: Re: SQL-Invoked Procedures for 8.1