Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id BC748B5DBC4 for ; Thu, 20 Oct 2011 00:52:08 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 33486-08 for ; Thu, 20 Oct 2011 03:52:02 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from mail-vx0-f174.google.com (mail-vx0-f174.google.com [209.85.220.174]) by mail.postgresql.org (Postfix) with ESMTP id 126D1B5DBC0 for ; Thu, 20 Oct 2011 00:52:01 -0300 (ADT) Received: by vcge1 with SMTP id e1so2118373vcg.19 for ; Wed, 19 Oct 2011 20:52:01 -0700 (PDT) Received: by 10.52.177.3 with SMTP id cm3mr9067614vdc.89.1319082721351; Wed, 19 Oct 2011 20:52:01 -0700 (PDT) Received: from ayaki.localdomain (124-169-43-32.dyn.iinet.net.au. [124.169.43.32]) by mx.google.com with ESMTPS id e4sm7705895vdt.11.2011.10.19.20.51.56 (version=SSLv3 cipher=OTHER); Wed, 19 Oct 2011 20:52:00 -0700 (PDT) Message-ID: <4E9F9AD8.1070003@ringerc.id.au> Date: Thu, 20 Oct 2011 11:51:52 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110930 Thunderbird/7.0.1 MIME-Version: 1.0 To: Tom Lane CC: Merlin Moncure , Robert Haas , Jan Wieck , Bruce Momjian , depstein@alliedtesting.com, pgsql-bugs@postgresql.org, pgagarinov@alliedtesting.com, vshahov@alliedtesting.com Subject: Re: Can't use WITH in a PERFORM query in PL/pgSQL? References: <29F36C7C98AB09499B1A209D48EAA615B501DA9401@mail2a.alliedtesting.com> <201109061743.p86HhQX16354@momjian.us> <19518.1319057158@sss.pgh.pa.us> <19857.1319059403@sss.pgh.pa.us> In-Reply-To: <19857.1319059403@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201110/189 X-Sequence-Number: 31459 On 10/20/2011 05:23 AM, Tom Lane wrote: > I wrote: >> Merlin Moncure writes: >>> The point being, how do I convert any query to a non WITH variant so >>> it can be PERFORM'd? Anyways, I always thought having to do perform >>> at all was pretty weak sauce -- not sure why it's required. > >> Possibly it was an Oracle compatibility thing ... anyone know PL/SQL >> well enough to say how this works there? > > After writing that, I remembered I had an old PL/SQL manual sitting > about, so I took a look. So far as I can see, there is no PERFORM > statement in PL/SQL, and no SELECT-without-INTO either; that is, the > functionality of executing a SELECT and discarding the result simply > isn't there. > > So at this point it looks like we made up PERFORM out of whole cloth, > and we could just as easily choose to do it another way. How does PL/SQL handle multiple result set returns? PL/PgSQL doesn't currently support that, but if true stored procedures land up in someone's sights down the track it'll be important to be able to support multiple result sets. If compatibility is of interest, then it'd be good to know whether PL/SQL uses "RETURN SELECT" or just "SELECT" to produce a result set. If it just uses "SELECT" (and it sounds like it does from the above) then perhaps retaining that meaning, and thus disallowing it from functions that cannot return multiple result sets, would be better. When true stored procs are implemented they can then permit bare SELECTs, emitting their output as a resultset. -- Craig Ringer