X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C6479D1B19F for ; Wed, 9 Jun 2004 11:53:38 -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 44291-10 for ; Wed, 9 Jun 2004 14:53:41 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 0CBCCD1B191 for ; Wed, 9 Jun 2004 11:53:37 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i59ErfuW021082; Wed, 9 Jun 2004 10:53:41 -0400 (EDT) To: craig perras Cc: pgsql-interfaces@postgresql.org Subject: Re: cleaning up in UDF's (user-defined functions) In-reply-to: <20040609022908.43286.qmail@web21208.mail.yahoo.com> References: <20040609022908.43286.qmail@web21208.mail.yahoo.com> Comments: In-reply-to craig perras message dated "Tue, 08 Jun 2004 19:29:08 -0700" Date: Wed, 09 Jun 2004 10:53:41 -0400 Message-ID: <21081.1086792821@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.1 tagged_above=0.0 required=5.0 tests=MAILTO_TO_SPAM_ADDR X-Spam-Level: * X-Archive-Number: 200406/18 X-Sequence-Number: 4946 craig perras writes: > I appended an excerpt from the docs... IIUC, if I make > a DSQL call from a UDF (written in C), and there's a > transaction abort caused by that command, then my > function is never called back. How do I cleanup any > resources the function allocated if this is the case? What resources? Most stuff (like palloc'd memory) is taken care of for you. If you're maintaining your own private permanent data structures then you may need to plug in a transaction-end hook routine to clean those up. pgsql-interfaces is hardly the place for discussing how to write C-language server functions; if you want to discuss the fine points I'd suggest pgsql-hackers. regards, tom lane