X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EC5485359D for ; Fri, 22 Apr 2005 17:02:06 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50580-02 for ; Fri, 22 Apr 2005 20:01:57 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id B5E0653571 for ; Fri, 22 Apr 2005 17:01:56 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j3MK1opG035511 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 22 Apr 2005 14:01:53 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j3MK1oNa093965; Fri, 22 Apr 2005 14:01:50 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j3MK1on0093964; Fri, 22 Apr 2005 14:01:50 -0600 (MDT) (envelope-from mfuhr) Date: Fri, 22 Apr 2005 14:01:50 -0600 From: Michael Fuhr To: Tom Lane Cc: Jakub Wo?ny , pgsql-sql@postgresql.org Subject: Re: C function - other process Message-ID: <20050422200150.GA93845@winnie.fuhr.org> References: <20050422211800.241cf201@localhost> <12255.1114198795@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <12255.1114198795@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/331 X-Sequence-Number: 21224 On Fri, Apr 22, 2005 at 03:39:55PM -0400, Tom Lane wrote: > Jakub =?ISO-8859-2?Q?Wo=BCny?= 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. 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 command -- I've done that in experiments but I've never been sure how safe it was. -- Michael Fuhr http://www.fuhr.org/~mfuhr/