Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> writes:
> A customer of ours has the need for temporary functions.
You can do that now:
regression=# create function pg_temp.foo(f1 int) returns int
regression-# as 'select $1+1' language sql;
CREATE FUNCTION
regression=# select pg_temp.foo(1);
foo
-----
2
(1 row)
You do have to qualify the name explicitly:
regression=# select foo(1);
ERROR: function foo(integer) does not exist
The latter is an intentional security feature and will not get changed.
The general security risks around this make me hesitant to accept the
idea of an explicit CREATE TEMP FUNCTION syntax: it's never going to
be better than a second-class feature, so it shouldn't have a
first-class syntax.
regards, tom lane