Sushrut Shivaswamy <sushrut(dot)shivaswamy(at)gmail(dot)com> writes:
> I'm developing a postgres extension as a custom Table Interface method
> definition.
> WIthin the extension, I"m planning to create two background processes using
> `fork()` that will process data in the background.
> Are there any recommendations / guidelines around creating background
> processes within extensions in postgres?
fork() is entirely the wrong way to do it, mainly because when the
creating session exits the postmaster will be unaware of those
now-disconnected child processes. See the mechanisms for creating
background worker processes (start with bgworker.h).
regards, tom lane