Received: from localhost (unknown [200.46.204.184]) by developer.postgresql.org (Postfix) with ESMTP id B95732E005B for ; Mon, 7 Apr 2008 10:39:09 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 45128-06 for ; Mon, 7 Apr 2008 10:38:52 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from www.postnewspapers.com.au (www.postnewspapers.com.au [202.61.230.242]) by developer.postgresql.org (Postfix) with ESMTP id 21B5D2E004B for ; Mon, 7 Apr 2008 10:39:00 -0300 (ADT) Received: from mail.postnewspapers.com.au (202-89-185-120.static.dsl.amnet.net.au [202.89.185.120]) by www.postnewspapers.com.au (Postfix) with ESMTP id 38F21D55FE; Mon, 7 Apr 2008 21:38:58 +0800 (WST) Received: from localhost (access [127.0.0.1]) by mail.postnewspapers.com.au (Postfix) with ESMTP id A540A1E0435; Mon, 7 Apr 2008 21:39:00 +0800 (WST) X-Virus-Scanned: Debian amavisd-new at postnewspapers.com.au Received: from mail.postnewspapers.com.au ([127.0.0.1]) by localhost (access.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id lkM0Bd+VQA6i; Mon, 7 Apr 2008 21:38:59 +0800 (WST) Received: from [203.161.97.213] (203.161.97.213.static.amnet.net.au [203.161.97.213]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "Craig Ringer", Issuer "POST Certificate Authority" (verified OK)) by mail.postnewspapers.com.au (Postfix) with ESMTP id B91FB1E0434; Mon, 7 Apr 2008 21:38:59 +0800 (WST) Message-ID: <47FA23EB.8060701@postnewspapers.com.au> Date: Mon, 07 Apr 2008 21:38:51 +0800 From: Craig Ringer User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: "luke.78@libero.it" Cc: pgsql-sql Subject: Re: Commit every processed record References: In-Reply-To: X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200804/44 X-Sequence-Number: 30583 luke.78@libero.it wrote: > Hi, > I have to execute commit for evey record that i processed during a cursor fetch in a function. > There is a way to do it? > > Sure. Do it outside PL/PgSQL, using a database client API like those available for Python, Java, Perl, etc. If you really need to do it in PL/PgSQL, is there any reason you can't do all the work in one transaction and commit when the function finishes? -- Craig Ringer