Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id B388E9F9398 for ; Tue, 5 Dec 2006 16:46:21 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 19611-05 for ; Tue, 5 Dec 2006 16:46:08 -0400 (AST) X-Greylist: delayed 00:13:40.527438 by SQLgrey-1.7.4 Received: from mail2.idilis.net (mail2.idilis.net [217.156.85.41]) by postgresql.org (Postfix) with ESMTP id EC9729F938C for ; Tue, 5 Dec 2006 16:46:10 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=easynet.ro; h=Received:Date:To:Subject:From:Organization:Content-Type:MIME-Version:References:Content-Transfer-Encoding:Message-ID:In-Reply-To:User-Agent; b=mpADC/Tqc3PSp7iUWajpWeaeOPY4bAw/Vj8tb0DwF8Kkv8zXNNJZD2V0I1R9Gp5jhQwi2o5ItG3MhefDcN9r/wgtLh9qAbmH/051lNHNlM68bc00NdMiJ+3h9WE0BBEC7mE0gBwhFumsu6IoQkSlqF590dKYPpou4KZIXy/ZbGg=; Received: from [193.231.120.40] (helo=adin) by mail2.idilis.net with esmtpa (Idilis Mail 5.3) (envelope-from ) id 1Grgxn-0004up-KQ; Tue, 05 Dec 2006 22:32:27 +0200 Date: Tue, 05 Dec 2006 22:32:16 +0200 To: "Marian POPESCU" , pgsql-sql@postgresql.org Subject: Re: transaction in function From: Din Adrian Organization: Acasa Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 References: Content-Transfer-Encoding: 7bit Message-ID: In-Reply-To: User-Agent: Opera Mail/9.02 (Win32) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=BAYES_50, SPF_PASS X-Spam-Level: X-Archive-Number: 200612/57 X-Sequence-Number: 27013 Any function runs into a single transaction so you don't need to worry about rolling back on exceptions - this is the standard behavior. If there is an exception while running any statement inside the function it's rolls back automatically. On Tue, 05 Dec 2006 17:25:31 +0200, Marian POPESCU wrote: > Hi, > > I want to write a function that updates several tables; if there is an > exception while updating, it should rollback the transaction and raise an > error. > > How can this be done in pgPLSQL in PostgreSQL 8.1 ? > > Thank you for helping me out on this one ! > > > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/