Re: [HACKERS] livetime of a variable defined in a c-procedure (fwd)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Victoria W(dot)" <wicki(at)terror(dot)de>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] livetime of a variable defined in a c-procedure (fwd)
Date: 1999-06-05 18:33:03
Message-ID: 3827.928607583@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Victoria W." <wicki(at)terror(dot)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

Browse pgsql-hackers by date

  From Date Subject
Next Message The Hermit Hacker 1999-06-05 18:36:16 Re: [PATCHES] Re: contrib code for 6.5
Previous Message Tom Lane 1999-06-05 18:25:20 Re: [HACKERS] Priorities for 6.6