Search Postgresql Archives

Re: Postgresql init and cleanup module functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sorry, replied only to direct sender, duplicating to both sender and mailing list
---
MSG1:
Thanks you, that is what I was looking for!

I was testing sample module and found it's behavior odd:
1. functions have few permissions, they even were not able to create file in "/tmp" directory. At least I'm able to use pglog (ereport(LOG, (errmsg("init")));)
2. _PG_init() is called separately for each connection right before any of the module's function is called by the client, so there are many instances of the module
3. For cleaning up I've use trick with standard 'atexit' function, called inside _PG_init() and it works properly
4. Global object's constructor and destructor are called on module unload.

I thought it works like "dlopen on postgres start, dlclose on postgres shutdown". I think I should stick to background worker process which will provide some C-Postgres functions
---
MSG2:
After reading bg workers' manual it seems to me that they cannot provide postgres functions. So the only way to achieve ONE global state and postgres functions using this state is to use some IPC between background process and dynamicaly loadable module (e.g. Unix/TCP sockets)

Regards, Yan

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux