X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2FF1FD6E83 for ; Thu, 6 Oct 2005 04:15:03 -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 07311-06 for ; Thu, 6 Oct 2005 07:14:59 +0000 (GMT) Received: from moon.antora.ru (moon.antora.ru [83.222.21.34]) by svr1.postgresql.org (Postfix) with ESMTP id 6CE0CDA302 for ; Thu, 6 Oct 2005 04:14:58 -0300 (ADT) Received: from [217.26.17.26] (helo=[10.0.0.72]) by moon.antora.ru with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.51 (FreeBSD)) id 1ENPxz-000PX6-BA; Thu, 06 Oct 2005 11:14:59 +0400 Message-ID: <4344CE37.2090407@bankir.ru> Date: Thu, 06 Oct 2005 11:11:51 +0400 From: "Eugene E." User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050517) X-Accept-Language: en-us, en MIME-Version: 1.0 To: padmanabha konkodi Cc: pgsql-sql@postgresql.org Subject: Re: catching errors in function References: <20051006065546.15349.qmail@webmail29.rediffmail.com> In-Reply-To: <20051006065546.15349.qmail@webmail29.rediffmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.061 required=5 tests=[AWL=0.061] X-Spam-Level: X-Archive-Number: 200510/48 X-Sequence-Number: 22901 > i have written function in which while executing it may throw error. > if the error thrown i want rollback the transaction if not i want commit. BEGIN; SELECT you_function(args); ... many sql commands; ... COMMIT; that's all if your function raises an error whole transaction will be aborted when the COMMIT is called.