Re: commit inside a function failing

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Suresh Raja <suresh(dot)rajaabc(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: commit inside a function failing
Date: 2015-01-23 20:04:17
Message-ID: 54C2A941.1000207@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-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-TRAPPING
>
>
> Thanks,
> -SR

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message ktm@rice.edu 2015-01-23 20:06:57 Re: [SQL] commit inside a function failing
Previous Message Pavel Stehule 2015-01-23 20:00:56 Re: [SQL] commit inside a function failing

Browse pgsql-sql by date

  From Date Subject
Next Message ktm@rice.edu 2015-01-23 20:06:57 Re: [SQL] commit inside a function failing
Previous Message Pavel Stehule 2015-01-23 20:00:56 Re: [SQL] commit inside a function failing