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/ -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers