"Victoria W." <wicki@terror.de> writes:
> CREATE FUNCTION add_rechnr(int4) RETURNS int4
> AS '/usr/local/pgsql/lib/modules/funcs.so' LANGUAGE 'c';
> whenever I add a value to rechnr, the correct result is returned. but if I
> copy a new file "funcs.so" into the direcotry while the backend is
> running and a connection is established, I'll get this error:
> pqReadData() -- backend closed the channel unexpectedly.
Overwriting a shared library that's in active use is a no-no on many
flavors of Unix. (The one I use won't even let you do it --- you get
a "text file busy" error if you try to delete or modify an open SL.)
I don't think there is an "unload shared library" function in Postgres
(it'd be hard or impossible to implement on some Unixes, anyway). So
the only way to stop referencing a shared library once it's been opened
is to terminate the backend process.
In short, if you've designed a solution that requires you to constantly
modify the shared library, you'd better look for another solution ---
or accept a lot of backend restarts.
regards, tom lane