Thread: Persistent user-defined functions

Persistent user-defined functions

From
David T
Date:
Hi all,

I am using Ubuntu 7.10 with PostgreSQL 8.2.  I have just finished creating two C functions and have successfully loaded
themusing "CREATE OR REPLACE FUNCTION" ... This was an extremely smooth process, and I have a lot of respect for the
devteam for creating such a robust system. 

Anyway - I would like these new functions to be permanently available to a database, or to all databases.  These
functionswill ultimately be called from PHP, where there is no guarantee of server state in between requests (maybe a
rebootoccurs and my functions are lost, etc...).  On the other hand, it is inefficient to "CREATE OR REPLACE" all the
time. Can anybody suggest a lightweight method to keep these functions permanently available, or point me towards a
resourcethat might assist? 

Best regards,

Dave.
_________________________________________________________________
This Valentine's Day, get creative and show your sweetheart how much you care with flair! Find fun date ideas here!
http://g.msn.ca/ca55/224

Re: Persistent user-defined functions

From
Martijn van Oosterhout
Date:
On Thu, Mar 27, 2008 at 11:10:39PM -0400, David T wrote:
> Anyway - I would like these new functions to be permanently available
> to a database, or to all databases.  These functions will ultimately
> be called from PHP, where there is no guarantee of server state in
> between requests (maybe a reboot occurs and my functions are lost,
> etc...).  On the other hand, it is inefficient to "CREATE OR REPLACE"
> all the time.  Can anybody suggest a lightweight method to keep these
> functions permanently available, or point me towards a resource that
> might assist?

Once you have created a function in a database, it stays until you drop
it. No crash will lose it for example. You will have to do the creation
once for each database and if you create them in template1 they will
automatically appear whenever you create a new database.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

Attachment

Re: Persistent user-defined functions

From
Felipe de Jesús Molina Bravo
Date:
if you create its in a template1 ....

regards...
El jue, 27-03-2008 a las 23:10 -0400, David T escribió:
> Hi all,
>
> I am using Ubuntu 7.10 with PostgreSQL 8.2.  I have just finished creating two C functions and have successfully
loadedthem using "CREATE OR REPLACE FUNCTION" ... This was an extremely smooth process, and I have a lot of respect for
thedev team for creating such a robust system. 
>
> Anyway - I would like these new functions to be permanently available to a database, or to all databases.  These
functionswill ultimately be called from PHP, where there is no guarantee of server state in between requests (maybe a
rebootoccurs and my functions are lost, etc...).  On the other hand, it is inefficient to "CREATE OR REPLACE" all the
time. Can anybody suggest a lightweight method to keep these functions permanently available, or point me towards a
resourcethat might assist? 
>
> Best regards,
>
> Dave.
> _________________________________________________________________
> This Valentine's Day, get creative and show your sweetheart how much you care with flair! Find fun date ideas here!
> http://g.msn.ca/ca55/224