Re: Create temporary function - Mailing list pgsql-general

From Tom Lane
Subject Re: Create temporary function
Date
Msg-id 15191.1208975632@sss.pgh.pa.us
Whole thread Raw
In response to Create temporary function  (Steve Crawford <scrawford@pinpointresearch.com>)
Responses Re: Create temporary function  (Steve Crawford <scrawford@pinpointresearch.com>)
List pgsql-general
Steve Crawford <scrawford@pinpointresearch.com> writes:
> I have recently run across situations that might benefit from the
> ability to create a temporary function.

You can do that today, as long as you don't mind schema-qualifying
uses of the function:

regression=# create function pg_temp.tfunc(int) returns int as
regression-# $$ select $1 + 1 $$ language sql;
CREATE FUNCTION
regression=# select pg_temp.tfunc(42);
 tfunc
-------
    43
(1 row)

Without the qualification, the function won't be found, even if
you put pg_temp into your search path explicitly.  That's intentional
because of the risk of trojan horses ...

            regards, tom lane

pgsql-general by date:

Previous
From: Steve Crawford
Date:
Subject: Create temporary function
Next
From: "Scott Marlowe"
Date:
Subject: Re: query question really cant give a summary here so read the body ;-)