pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Eugene E. <sad@bankir.ru>
To: padmanabha konkodi <konkodi221@rediffmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: catching errors in  function
Date: Thu, 06 Oct 2005 11:11:51 +0400
Message-ID: <4344CE37.2090407@bankir.ru> (raw)
In-Reply-To: <20051006065546.15349.qmail@webmail29.rediffmail.com>
References: <20051006065546.15349.qmail@webmail29.rediffmail.com>

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



view thread (3+ messages)  latest in thread

Message-ID: <4344CE37.2090407@bankir.ru>
Permalink:  ../4344CE37.2090407@bankir.ru/
Also on:    postgresql.org/message-id/4344CE37.2090407@bankir.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sad@bankir.ru, konkodi221@rediffmail.com
  Subject: Re: catching errors in  function
  In-Reply-To: <4344CE37.2090407@bankir.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox