From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | john(at)antefacto(dot)com |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: writing & flushing C extensions |
Date: | 2001-10-15 15:02:10 |
Message-ID: | 14341.1003158130@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"John P. Looney" <john(at)antefacto(dot)com> writes:
> I'm trying to write a few functions in C for postgres. But, when I change
> some code, I'm never sure that it'll be flushed when I do a;
> DROP FUNCTION test();
> CREATE FUNCTION test() RETURNS text AS '/var/lib/pgsql/functions/test.so' LANGUAGE 'c';
Actually, you can be pretty sure that it *won't* be flushed; once a
backend has loaded a dynamic link library, the library stays loaded
till the backend exits. Dropping/recreating individual function
definitions that point at the library makes no difference.
I believe the only way to get an updated copy of a library without
starting a new backend is to execute the LOAD command, which will
unload and reload the library.
> Is there a way to make sure ? Even restarting postgres doesn't always
> work (or else my makefiles are broken...)
Better take a hard look at your makefiles then... a fresh backend
definitely will load the current copy of the .so file on first reference
to any function in it.
You didn't say what platform you are on, but on some platforms it's
not allowed to delete or overwrite a shared library file that is
currently open for execution. If yours is like this then the makefile's
attempt to install the new .so might be failing. Best solution that
I know of is to move the old .so out of the way, install the new,
then attempt to delete the old.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Denis Gasparin | 2001-10-15 15:06:05 | Re: VACUUM, 24/7 availability and 7.2 |
Previous Message | Tom Lane | 2001-10-15 14:41:51 | Re: lztext |