Thread: The persistance of C functions
If I use CREATE FUNCTION for a C function in a .so file and then use the function and then change and recompile the function, what steps are needed to see the change? As I see it the options are: A: do nothing, the function is reloaded on every invocation. B: Reopen the connection to the backend C: Restart the postmaster I suspect B is correct but I would like to hear someone confirm it.
On 09-Feb-00 Bryan White wrote: > If I use CREATE FUNCTION for a C function in a .so file and then use the > function and then change and recompile the function, what steps are needed > to see the change? > > As I see it the options are: > A: do nothing, the function is reloaded on every invocation. > B: Reopen the connection to the backend > C: Restart the postmaster > > I suspect B is correct but I would like to hear someone confirm it. I don't know about A or B, but C definitely works :-). If it's practical, I sometimes use DROP FUNCTION/CREATE FUNCTION, but I don't think this is practical when you're using this function (or set of functions) to implement a new data type. ---------------------------------- Date: 09-Feb-00 Time: 14:16:54 Craig Orsinger (email: <orsingerc@epg-gw1.lewis.army.mil>) Logicon RDA Bldg. 8B28 "Just another megalomaniac with ideas above his 6th & F Streets station. The Universe is full of them." Ft. Lewis, WA 98433 - The Doctor ----------------------------------
> On 09-Feb-00 Bryan White wrote: > > If I use CREATE FUNCTION for a C function in a .so file and then use the > > function and then change and recompile the function, what steps are needed > > to see the change? > > > > As I see it the options are: > > A: do nothing, the function is reloaded on every invocation. > > B: Reopen the connection to the backend > > C: Restart the postmaster > > > > I suspect B is correct but I would like to hear someone confirm it. > > I don't know about A or B, but C definitely works :-). If it's > practical, I sometimes use DROP FUNCTION/CREATE FUNCTION, but I don't > think this is practical when you're using this function (or set of > functions) to implement a new data type. Thanks, I have come to the conclusion that B is sufficient based on trial and error.
On Wed, 9 Feb 2000, Bryan White wrote: > If I use CREATE FUNCTION for a C function in a .so file and then use the > function and then change and recompile the function, what steps are needed > to see the change? > > As I see it the options are: > A: do nothing, the function is reloaded on every invocation. > B: Reopen the connection to the backend > C: Restart the postmaster > > I suspect B is correct but I would like to hear someone confirm it. 'B' is right - the postgreSQL not has any persisten cache for this, and if you restart connection a backend reload this information again. Or you can drop/(re)create a function, it is total safe solution. Karel
On Thu, Feb 10, 2000 at 10:42:29AM +0100, Karel Zak - Zakkr wrote: > > On Wed, 9 Feb 2000, Bryan White wrote: > > > If I use CREATE FUNCTION for a C function in a .so file and then use the > > function and then change and recompile the function, what steps are needed > > to see the change? > > > > As I see it the options are: > > A: do nothing, the function is reloaded on every invocation. > > B: Reopen the connection to the backend > > C: Restart the postmaster > > > > I suspect B is correct but I would like to hear someone confirm it. > > > 'B' is right - the postgreSQL not has any persisten cache for this, and > if you restart connection a backend reload this information again. > > Or you can drop/(re)create a function, it is total safe solution. Not _totally_ safe: if you've got anything that refers to that function, like a user defined type definition, drop/(re)create will change the function's oid in the pg_proc table, causing errors when the old function is looked up. Hmm, an ALTER FUNCTION command might be nice... Ross -- Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu> NSBRI Research Scientist/Programmer Computer and Information Technology Institute Rice University, 6100 S. Main St., Houston, TX 77005