Re: Full Stored Procedure Support, any time soon ?

From: Noel Diaz <zerg2k(at)yahoo(dot)com>
To: Thomas Kellerer <spam_eater(at)gmx(dot)net>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Full Stored Procedure Support, any time soon ?
Date: 2013-11-30 22:30:59
Message-ID: 1385850659.6948.YahooMailNeo@web162505.mail.bf1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thomas, RIGHT ON!

Sometimes I have seen this feature used to hide multiple round trips and intermediate result processing from the clients
Some others is simply because the client is generating a predefined data structure that has little resemblance to the schema and this "feature" becomes convenient
Some others is "ad-hoc" tools that allow to see multiple datasets in the UI, etc...

Anyway I just saw this in the TODO list: (http://wiki.postgresql.org/wiki/Todo) :

_ Implement stored procedures
This might involve the control of transaction state and the return of multiple result sets
* PL/pgSQL stored procedure returning multiple result sets (SELECTs)?
* Proposal: real procedures again (8.4)
* http://archives.postgresql.org/pgsql-hackers/2010-09/msg00542.php
* Gathering specs and discussion on feature (post 9.1)

Does anybody know if any the committers are working on that list?

On Saturday, November 30, 2013 5:21 PM, Thomas Kellerer <spam_eater(at)gmx(dot)net> wrote:

Alban Hertroys wrote on 30.11.2013 22:34:

>> - Multiple result sets
>
> Since you’re talking about procedures, you can’t possibly mean that those return multiple result sets?

Yes, basically something like this:

create procedure foobar()
begin
  select * from table_1;
  select * from table_2
end;

I know that at least SQL Server and MySQL can do that. Maybe others as well (Sybase most probably).

But I always failed do see the actual advantage of that because the results can't be "used" any further (e.g. in a JOIN or a subselect).
I also don't understand why having a single procedure doing a lot of stuff is better than having several procedures (or functions) doing one defined thing.

From a JDBC point of view the code simply asks the Statement whether it has any more result sets
and loops over this until all results are returned.

Thomas

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2013-11-30 22:47:06 Re: Full Stored Procedure Support, any time soon ?
Previous Message Thomas Kellerer 2013-11-30 22:21:36 Re: Full Stored Procedure Support, any time soon ?