On 30.5.2012 22:35, Tom Lane wrote:
> Tomas Vondra <tv@fuzzy.cz> writes:
>> whenever I run a C-function (part of an .so file) and the file is
>> overwritten, the connection crashes. Tested on 9.1.3 and 9.2-beta1.
>
> "Doctor, it hurts when I do this."
> "So don't do that."
>
> What exactly would you expect Postgres to do about such a thing, anyway?
> It has no control over people overwriting its executable files.
Well, I expected the existing connection will use the old .so, while new
connections would use the new version (although they're exactly the
same). I suppose there are issues with that option too, but crashing the
server is a bit unfortunate ...
And it actually happens even when the file is overwritten between two
queries. I wonder how this affects installing new versions of extensions
- does that mean I can't do that while the database is running?
Is this mentioned in the docs, somewhere? IMHO there should be a big red
banner "DON'T DO THIS" but all I found is this:
http://www.postgresql.org/docs/9.1/interactive/xfunc-c.html
After it is used for the first time, a dynamically loaded object
file is retained in memory. Future calls in the same session to the
function(s) in that file will only incur the small overhead of a
symbol table lookup. If you need to force a reload of an object
file, for example after recompiling it, begin a fresh session.
Which kinda looks like my expectation that the session won't crash was
correct. Clearly seems like bug to me.
Tomas