Re: PL/pgSQL PERFORM with CTE - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: PL/pgSQL PERFORM with CTE
Date
Msg-id CAFj8pRAH9kQ46A43bYfHhGNEPOyA5pEv_qdyH-YuHBtBM3+waQ@mail.gmail.com
Whole thread Raw
In response to Re: PL/pgSQL PERFORM with CTE  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: PL/pgSQL PERFORM with CTE  ("David E. Wheeler" <david@justatheory.com>)
List pgsql-hackers



2013/8/24 Tom Lane <tgl@sss.pgh.pa.us>
Pavel Stehule <pavel.stehule@gmail.com> writes:
> Oracle has a special function for returning sets from procedures - see a
> new functionality "Implicit Result Sets"
> http://tkyte.blogspot.cz/2013/07/12c-implicit-result-sets.html

That article is worth reading, because Tom K. points out exactly why
T-SQL's approach is a bad idea compared to returning refcursors.
It's not clear to me that we should be in a hurry to go there, much less
try to be 100% syntax compatible with it.

I disagree - Tom K. speaking about what he likes or dislikes (and about what he didn't use) He forgot about strong points of implicit result or interesting points. Clients usually has no problem with dynamic datasets - PHP, DBI, Llibpq, GUI components .. all libs support a generic access and this generic access is often used due less dependency on queries.

There are a three interesting possibilities of implicit result sets:

* Possibility to return dynamic dataset - when you don't know a result before execution - typical use case is a some form of pivot tables or some analytics queries.

* Possibility to return multiple results as flattening of some multidimensional data.

* Possibilty to write multiresults reports for one call execution.

This functionality can be emulated by refcursors sets, but it is significantly less user friendly - so it is not widely used on Oracle's world.

regards

Pavel

 

                        regards, tom lane

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Support for REINDEX CONCURRENTLY
Next
From: Vik Fearing
Date:
Subject: Re: Patch: Allow formatting in log_line_prefix