agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedcommit inside a function failing
5+ messages / 5 participants
[nested] [flat]
* commit inside a function failing
@ 2015-01-23 19:56 Suresh Raja <suresh.rajaabc@gmail.com>
2015-01-23 20:00 ` Re: [SQL] commit inside a function failing Pavel Stehule <pavel.stehule@gmail.com>
2015-01-23 20:04 ` Re: commit inside a function failing Adrian Klaver <adrian.klaver@aklaver.com>
2015-01-23 20:06 ` Re: [SQL] commit inside a function failing ktm@rice.edu <ktm@rice.edu>
0 siblings, 3 replies; 5+ messages in thread
From: Suresh Raja @ 2015-01-23 19:56 UTC (permalink / raw)
To: pgsql-general@postgresql.org; pgsql-sql
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
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [SQL] commit inside a function failing
2015-01-23 19:56 commit inside a function failing Suresh Raja <suresh.rajaabc@gmail.com>
@ 2015-01-23 20:00 ` Pavel Stehule <pavel.stehule@gmail.com>
2 siblings, 0 replies; 5+ messages in thread
From: Pavel Stehule @ 2015-01-23 20:00 UTC (permalink / raw)
To: Suresh Raja <suresh.rajaabc@gmail.com>; +Cc: " <pgsql-general@postgresql.org>; pgsql-sql
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
>
> Thanks,
> -SR
>
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: commit inside a function failing
2015-01-23 19:56 commit inside a function failing Suresh Raja <suresh.rajaabc@gmail.com>
@ 2015-01-23 20:04 ` Adrian Klaver <adrian.klaver@aklaver.com>
2 siblings, 0 replies; 5+ messages in thread
From: Adrian Klaver @ 2015-01-23 20:04 UTC (permalink / raw)
To: Suresh Raja <suresh.rajaabc@gmail.com>; pgsql-general@postgresql.org; 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-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
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [SQL] commit inside a function failing
2015-01-23 19:56 commit inside a function failing Suresh Raja <suresh.rajaabc@gmail.com>
@ 2015-01-23 20:06 ` ktm@rice.edu <ktm@rice.edu>
2 siblings, 0 replies; 5+ messages in thread
From: ktm@rice.edu @ 2015-01-23 20:06 UTC (permalink / raw)
To: Suresh Raja <suresh.rajaabc@gmail.com>; +Cc: pgsql-general@postgresql.org; 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
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: commit inside a function failing
@ 2015-01-24 15:26 Christopher Browne <cbbrowne@sympatico.ca>
0 siblings, 0 replies; 5+ messages in thread
From: Christopher Browne @ 2015-01-24 15:26 UTC (permalink / raw)
To: Suresh Raja <suresh.rajaabc@gmail.com>; +Cc: pgsql-sql@postgresql.org, PostgreSQL Mailing Lists <pgsql-general@postgresql.org>
<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>
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2015-01-24 15:26 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-01-23 19:56 commit inside a function failing Suresh Raja <suresh.rajaabc@gmail.com>
2015-01-23 20:00 ` Pavel Stehule <pavel.stehule@gmail.com>
2015-01-23 20:04 ` Adrian Klaver <adrian.klaver@aklaver.com>
2015-01-23 20:06 ` ktm@rice.edu <ktm@rice.edu>
2015-01-24 15:26 Re: commit inside a function failing Christopher Browne <cbbrowne@sympatico.ca>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox