Re: [SQL] C function - other process

2005-04-22 Thread Michael Fuhr
On Fri, Apr 22, 2005 at 03:39:55PM -0400, Tom Lane wrote: > Jakub =?ISO-8859-2?Q?Wo=BCny?= <[EMAIL PROTECTED]> writes: > > I wrote a simple function: > > > signal(SIGCHLD,SIG_IGN); > > switch(fork()) > > This will NOT work. It WILL corrupt your database. You do not get to > randomly int

Re: [SQL] C function - other process

2005-04-22 Thread Tom Lane
Jakub =?ISO-8859-2?Q?Wo=BCny?= <[EMAIL PROTECTED]> writes: > I wrote a simple function: > signal(SIGCHLD,SIG_IGN); > switch(fork()) This will NOT work. It WILL corrupt your database. You do not get to randomly introduce new processes into the backend set. regard

Re: [SQL] C function - other process

2005-04-22 Thread Michael Fuhr
On Fri, Apr 22, 2005 at 04:07:48PM -0400, Tom Lane wrote: > > Execing some new program is safe enough, although you might wish to > explicitly close the various sockets the backend holds to make sure > the new program doesn't maliciously scribble on them. Is there a way to find out which fds to c

Re: [SQL] C function - other process

2005-04-22 Thread Tom Lane
Michael Fuhr <[EMAIL PROTECTED]> writes: > What about fork() followed by exec*(), either explicitly or via > popen(), system(), etc.? Should these be avoided as well, or is > there a safe way to do them? I'm thinking of the case where a > user-defined function wants to invoke some external comman

[SQL] C function - other process

2005-04-22 Thread Jakub Woźny
Hello, I wrote a simple function: PG_FUNCTION_INFO_V1(my_fcn); Datum my_fcn() { int i,ret; i=0; signal(SIGCHLD,SIG_IGN); switch(fork()) { case 0: { SPI_connect(); for(i=0;i<10;i++) { SPI_exec("insert i