Re: catching errors in function

From: "Eugene E(dot)" <sad(at)bankir(dot)ru>
To: padmanabha konkodi <konkodi221(at)rediffmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: catching errors in function
Date: 2005-10-06 07:11:51
Message-ID: 4344CE37.2090407@bankir.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> 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.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message xchris 2005-10-06 10:40:06 Noob question about types and lists
Previous Message padmanabha konkodi 2005-10-06 06:55:46 catching errors in function