agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Suresh Raja <suresh.rajaabc@gmail.com>
To: pgsql-general@postgresql.org
To: pgsql-sql@postgresql.org
Subject: Re: commit inside a function failing
Date: Fri, 23 Jan 2015 12:04:17 -0800
Message-ID: <54C2A941.1000207@aklaver.com> (raw)
In-Reply-To: <CAJP7dtA41j212Q48eRGoJa6_yb6YnRXj_kEth=N-0cPOgWe8fQ@mail.gmail.com>
References: <CAJP7dtA41j212Q48eRGoJa6_yb6YnRXj_kEth=N-0cPOgWe8fQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>

On 01/23/2015 11:56 AM, Suresh Raja wrote:
> Hi All:
>
> We are running a function with a loop in it. We tried
> commit;
> We are getting error with above command.   How can i easily commit
> withing a function.

Functions do not have transactions inside them. If you are using plpgsql 
you can use EXCEPTIONS:

http://www.postgresql.org/docs/9.3/interactive/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPIN...
>
>
> Thanks,
> -SR


-- 
Adrian Klaver
adrian.klaver@aklaver.com


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (5+ messages)  latest in thread

Message-ID: <54C2A941.1000207@aklaver.com>
Permalink:  ../54C2A941.1000207@aklaver.com/
Also on:    postgresql.org/message-id/54C2A941.1000207@aklaver.com

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: adrian.klaver@aklaver.com, suresh.rajaabc@gmail.com, pgsql-general@postgresql.org
  Subject: Re: commit inside a function failing
  In-Reply-To: <54C2A941.1000207@aklaver.com>

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

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