Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 93DC363524A for ; Sat, 15 Aug 2009 22:48:33 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 89941-08 for ; Sun, 16 Aug 2009 01:48:14 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from frubble.xen.chris-lamb.co.uk (frubble.xen.chris-lamb.co.uk [89.16.166.12]) by mail.postgresql.org (Postfix) with ESMTP id DCE5B634D79 for ; Sat, 15 Aug 2009 22:48:22 -0300 (ADT) Received: from sam by frubble.xen.chris-lamb.co.uk with local (Exim 4.63) (envelope-from ) id 1McUr5-000544-AG for pgsql-hackers@postgresql.org; Sun, 16 Aug 2009 02:48:19 +0100 Date: Sun, 16 Aug 2009 02:48:19 +0100 From: Sam Mason To: pgsql-hackers@postgresql.org Subject: Re: GRANT ON ALL IN schema Message-ID: <20090816014819.GT5407@samason.me.uk> References: <200908101042.35024.peter_e@gmx.net> <4A7FE7F902000025000296E3@gw.wicourts.gov> <4A803A89.9020509@dunslane.net> <2CCE9C1D-919D-45D5-BFC2-C7723C45064E@hi-media.com> <162867790908150434j7aef36ecm202e81c4bb4740fa@mail.gmail.com> <4A86B5D5.6060807@dunslane.net> <4A871F46.1040002@agliodbs.com> <5D5ECAE0-F2B0-479B-9594-50AAF18F10ED@hi-media.com> <20090815223102.GS5407@samason.me.uk> <1250378139.18992.6.camel@vanquo.pezone.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1250378139.18992.6.camel@vanquo.pezone.net> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200908/1213 X-Sequence-Number: 143856 On Sun, Aug 16, 2009 at 02:15:39AM +0300, Peter Eisentraut wrote: > On 2009-08-15 at 23:31 +0100, Sam Mason wrote: > > Next all you need is to be able to PREPARE them (and somehow access the > > parameters from execute) and you'll have nice local functions. :) > > Yeah, rather than just making up some new command for "execute this > string", this could be generalized as lambda expressions that could be > called whereever an expression is allowed. E.g. > > SELECT LAMBDA $$ ... $$; [..] > SELECT (LAMBDA (x int, y text) $$ ... $$) (37, 'foo'); I can't quite tell if you're being serious or not, you realize that this leaves open the possibility of doing: SELECT t.n, f.op, f.fn(t.n) FROM generate_series(1,10) t(n), (VALUES ('id',LAMBDA (_x int) $$ BEGIN; RETURN _x; END; $$), ('*2',LAMBDA (_x int) $$ BEGIN; RETURN _x*2; END; $$)) f(op,fn) And of storing lambda abstractions in tables? -- Sam http://samason.me.uk/