Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 96317634DA0 for ; Mon, 10 Aug 2009 12:23:01 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 92313-06-2 for ; Mon, 10 Aug 2009 15:22:59 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from alexis.jtlnet.com (alexis.jtlnet.com [69.36.9.81]) by mail.postgresql.org (Postfix) with ESMTP id B660A635437 for ; Mon, 10 Aug 2009 12:20:10 -0300 (ADT) Received: from [192.168.10.103] (cpe-075-177-154-027.nc.res.rr.com [::ffff:75.177.154.27]) (TLS: TLSv1/SSLv3,256bits,AES256-SHA) by alexis.jtlnet.com with esmtp; Mon, 10 Aug 2009 11:14:49 -0400 id 00088070.4A803974.00001747 Message-ID: <4A803A89.9020509@dunslane.net> Date: Mon, 10 Aug 2009 11:19:37 -0400 From: Andrew Dunstan User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.0.12) Gecko/20071019 Fedora/1.0.9-3.fc6 pango-text SeaMonkey/1.0.9 MIME-Version: 1.0 To: Kevin Grittner CC: Peter Eisentraut , pgsql-hackers@postgresql.org, Nikhil Sontakke , Robert Haas , Petr Jelinek , Stephen Frost , Tom Lane Subject: Re: GRANT ON ALL IN schema References: <4A37BF63.50008@pjmodos.net> <603c8f070908050951s3e5df452se4c610f01b80bb7d@mail.gmail.com> <21246.1249491592@sss.pgh.pa.us> <200908101042.35024.peter_e@gmx.net> <4A7FE7F902000025000296E3@gw.wicourts.gov> In-Reply-To: <4A7FE7F902000025000296E3@gw.wicourts.gov> Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.598 tagged_above=-10 required=5 tests=BAYES_00=-2.599, FB_WORD1_END_DOLLAR=0.001 X-Spam-Level: X-Archive-Number: 200908/790 X-Sequence-Number: 143433 Kevin Grittner wrote: > Peter Eisentraut wrote: > > >> This would become much simpler if you could just execute plpgsql >> code instead of having to define a function around it. >> > > I have often wished for that feature. > > You're not Robinson Crusoe. It could be done in several ways. One fairly simple way would use a new SQL verb (say, DO) like this: DO $$ something in plfoo$ $ LANGUAGE plfoo; We could even default the langauge to plpgsql, for which you would then just need: DO $$ something in plpgsql $$; The something would in effect be treated as a throwaway function taking no parameters and returning void. But to make it really nice you'd have to move away from pl programs as strings. That would be a lot more work, and you really wouldn't want to make it work with more than one PL for the sake of everyone's sanity. cheers andrew