commit inside a function failing
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.
Thanks,
-SR
Hi
2015-01-23 20:56 GMT+01:00 Suresh Raja <suresh.rajaabc@gmail.com>:
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.
It is not possible in PostgreSQL
Regards
Pavel Stehule
Show quoted text
Thanks,
-SR
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:
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
On Fri, Jan 23, 2015 at 01:56:53PM -0600, 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.Thanks,
-SR
PostgreSQL functions run within a transaction. You would need to use
something like db_link.
Regards,
Ken
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
<p dir="ltr">The straightforward answer is that stored functions always run *inside* the context of a preexisting transaction, therefore you cannot request a separate transaction from within a stored function.</p>
<p dir="ltr">What you are asking is fairly deeply impossible.</p>
Import Notes
Resolved by subject fallback