Skip site navigation (1) Skip section navigation (2)

transactions within stored procedures

From: Nathan Young <nyoung(at)silcom(dot)com>
To: pgsql <pgsql-sql(at)postgresql(dot)org>
Subject: transactions within stored procedures
Date: 2000-07-14 16:02:44
Message-ID: 396F39A4.7D4B0B69@silcom.com (view raw or flat)
Thread:
Lists: pgsql-sql
Hi.

Please correct me if this is off topic for the group.  On looking
through the available postgres mailing lists, this seemed the most
appropriate for my question.

Transactions are important to my application.  I was scripting in perl
with autocommit turned off, issuing commits when appropriate.  As I
moved more of my logic into stored procedures, I looked for
documentation on how transactions work in stored procedures and I
couldn't find any!  I'm using pl/pgsql right now but would happily use
pg/perl...

By trial and error I established that a SP wraps everything it does in
one transaction, including anything from stored procedures it calls.

So here is my question:  Is there any way for me to control when
transactions are committed or rolled back within stored procedures?  Is
there an equivalent to turning autocommit off, in other words doing each
statement in its own transaction?  Or is there a command to let me
commit whenever I want to?  Also, can I roll back a transaction based on
programmatically defined logic, or only on a database error?

Thanks in advance...

--------------------->Nathan
-- 



¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤


Nathan Young
nathan(at)ncyoung(dot)com
(805) 686-2830

pgsql-sql by date

Next:From: Thomas MackDate: 2000-07-14 16:19:17
Subject: Re: transactions within stored procedures
Previous:From: Tom LaneDate: 2000-07-14 15:49:02
Subject: Re: Trigger

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group