469,081 Members | 1,804 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,081 developers. It's quick & easy.

nested transaction

Hello,

The new release includes savepoints, but I need to do a begin inside another
begin and a commit/rollback after another commit/rollback.

For example, I have a pA procedure that update some data, so this procedure
execute a begin, after manipulate data and ends with commit/rollback. pA
procedure can to be called directly by the client aplication. In other hand,
I have a pB procedure that also update some data and calls pA procedure, so
pB procedure execute a begin, after manipulate data, after call pA procedure
and ends with commit/rollback. pB procedure can also to be called directly
by the client aplication.

The problem is that pA procedure can't do a new transaction, so what can I
do?
Is possible to detect from pA that there is a transaction and so do a
savepoint instead of a begin?

Thanks in advance,

pere

Nov 23 '05 #1
2 2126
Am Dienstag, 10. August 2004 13:30 schrieb "Rodríguez Rodríguez, Pere":
For example, I have a pA procedure that update some data, so this procedure
execute a begin, after manipulate data and ends with commit/rollback. pA
procedure can to be called directly by the client aplication. In other
hand, I have a pB procedure that also update some data and calls pA
procedure, so pB procedure execute a begin, after manipulate data, after
call pA procedure and ends with commit/rollback. pB procedure can also to
be called directly by the client aplication.

The problem is that pA procedure can't do a new transaction, so what can I
do?


Use savepoints all the time.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #2
=?ISO-8859-1?Q?=22Rodr=EDguez_Rodr=EDguez=2C_Pere=22?= <pr*@hosppal.es> writes:
Is possible to detect from pA that there is a transaction and so do a
savepoint instead of a begin?


Depends on what you're programming in, but in principle yes. If using
libpq, see PQtransactionStatus().

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Jason Godden | last post: by
9 posts views Thread by John Sidney-Woollett | last post: by
6 posts views Thread by Thapliyal, Deepak | last post: by
2 posts views Thread by Andreas | last post: by
reply views Thread by Pavel Stehule | last post: by
2 posts views Thread by Gerrit.Horeis | last post: by
1 post views Thread by Mana | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.