Re: temporary functions (and other object types) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: temporary functions (and other object types)
Date
Msg-id 578.1288987327@sss.pgh.pa.us
Whole thread Raw
In response to temporary functions (and other object types)  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Responses Re: temporary functions (and other object types)
List pgsql-hackers
Alvaro Herrera <alvherre@alvh.no-ip.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


pgsql-hackers by date:

Previous
From: Marti Raudsepp
Date:
Subject: Re: [PATCH] Revert default wal_sync_method to fdatasync on Linux 2.6.33+
Next
From: Alvaro Herrera
Date:
Subject: Re: ALTER OBJECT any_name SET SCHEMA name