Re: PL/pgSQL PERFORM with CTE

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, Marko Tiikkaja <marko(at)joh(dot)to>, Jan Wieck <JanWieck(at)yahoo(dot)com>, Andres Freund <andres(at)2ndquadrant(dot)com>, "David E(dot) Wheeler" <david(at)justatheory(dot)com>, pgsql-hackers Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PL/pgSQL PERFORM with CTE
Date: 2013-08-27 07:30:07
Message-ID: CAFj8pRAH9kQ46A43bYfHhGNEPOyA5pEv_qdyH-YuHBtBM3+waQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2013/8/24 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>

> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)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
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vik Fearing 2013-08-27 07:55:57 Re: Patch: Allow formatting in log_line_prefix
Previous Message Michael Paquier 2013-08-27 06:34:22 Re: Support for REINDEX CONCURRENTLY