dbTalk Databases Forums  

Nested Transactions

comp.databases.postgresql comp.databases.postgresql


Discuss Nested Transactions in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Thomas Guettler
 
Posts: n/a

Default Nested Transactions - 09-10-2008 , 03:18 AM






Hi,

postgres supports nested transactions by using savepoints.
Unfortunately savepoints get lost after a commit.

Is there any plan to support nested transactions with
several (stacked) begin/commit statements?

I guess that it does *not* require a big code change:
If "begin" is used during a transaction it should behave
like a savepoint. And "commit/rollback" removes the last
element from the stack and does a real commit if the stack
gets empty.

Thomas

--
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de

Reply With Quote
  #2  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: Nested Transactions - 09-10-2008 , 04:05 AM






Thomas Guettler <hv (AT) tbz-pariv (DOT) de> wrote:
Quote:
postgres supports nested transactions by using savepoints.
Unfortunately savepoints get lost after a commit.

Is there any plan to support nested transactions with
several (stacked) begin/commit statements?
I don't know for sure, but I don't find "nested transactions" in the TODO
list.

Quote:
I guess that it does *not* require a big code change:
If "begin" is used during a transaction it should behave
like a savepoint. And "commit/rollback" removes the last
element from the stack and does a real commit if the stack
gets empty.
It is not that simple.
A nested transaction must be able to commit even if the surrounding
transaction rolls back. You cannot do that with savepoints.

Yours,
Laurenz Albe


Reply With Quote
  #3  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: Nested Transactions - 09-10-2008 , 04:05 AM



Thomas Guettler <hv (AT) tbz-pariv (DOT) de> wrote:
Quote:
postgres supports nested transactions by using savepoints.
Unfortunately savepoints get lost after a commit.

Is there any plan to support nested transactions with
several (stacked) begin/commit statements?
I don't know for sure, but I don't find "nested transactions" in the TODO
list.

Quote:
I guess that it does *not* require a big code change:
If "begin" is used during a transaction it should behave
like a savepoint. And "commit/rollback" removes the last
element from the stack and does a real commit if the stack
gets empty.
It is not that simple.
A nested transaction must be able to commit even if the surrounding
transaction rolls back. You cannot do that with savepoints.

Yours,
Laurenz Albe


Reply With Quote
  #4  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: Nested Transactions - 09-10-2008 , 04:05 AM



Thomas Guettler <hv (AT) tbz-pariv (DOT) de> wrote:
Quote:
postgres supports nested transactions by using savepoints.
Unfortunately savepoints get lost after a commit.

Is there any plan to support nested transactions with
several (stacked) begin/commit statements?
I don't know for sure, but I don't find "nested transactions" in the TODO
list.

Quote:
I guess that it does *not* require a big code change:
If "begin" is used during a transaction it should behave
like a savepoint. And "commit/rollback" removes the last
element from the stack and does a real commit if the stack
gets empty.
It is not that simple.
A nested transaction must be able to commit even if the surrounding
transaction rolls back. You cannot do that with savepoints.

Yours,
Laurenz Albe


Reply With Quote
  #5  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: Nested Transactions - 09-10-2008 , 04:05 AM



Thomas Guettler <hv (AT) tbz-pariv (DOT) de> wrote:
Quote:
postgres supports nested transactions by using savepoints.
Unfortunately savepoints get lost after a commit.

Is there any plan to support nested transactions with
several (stacked) begin/commit statements?
I don't know for sure, but I don't find "nested transactions" in the TODO
list.

Quote:
I guess that it does *not* require a big code change:
If "begin" is used during a transaction it should behave
like a savepoint. And "commit/rollback" removes the last
element from the stack and does a real commit if the stack
gets empty.
It is not that simple.
A nested transaction must be able to commit even if the surrounding
transaction rolls back. You cannot do that with savepoints.

Yours,
Laurenz Albe


Reply With Quote
  #6  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: Nested Transactions - 09-10-2008 , 04:05 AM



Thomas Guettler <hv (AT) tbz-pariv (DOT) de> wrote:
Quote:
postgres supports nested transactions by using savepoints.
Unfortunately savepoints get lost after a commit.

Is there any plan to support nested transactions with
several (stacked) begin/commit statements?
I don't know for sure, but I don't find "nested transactions" in the TODO
list.

Quote:
I guess that it does *not* require a big code change:
If "begin" is used during a transaction it should behave
like a savepoint. And "commit/rollback" removes the last
element from the stack and does a real commit if the stack
gets empty.
It is not that simple.
A nested transaction must be able to commit even if the surrounding
transaction rolls back. You cannot do that with savepoints.

Yours,
Laurenz Albe


Reply With Quote
  #7  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: Nested Transactions - 09-10-2008 , 04:05 AM



Thomas Guettler <hv (AT) tbz-pariv (DOT) de> wrote:
Quote:
postgres supports nested transactions by using savepoints.
Unfortunately savepoints get lost after a commit.

Is there any plan to support nested transactions with
several (stacked) begin/commit statements?
I don't know for sure, but I don't find "nested transactions" in the TODO
list.

Quote:
I guess that it does *not* require a big code change:
If "begin" is used during a transaction it should behave
like a savepoint. And "commit/rollback" removes the last
element from the stack and does a real commit if the stack
gets empty.
It is not that simple.
A nested transaction must be able to commit even if the surrounding
transaction rolls back. You cannot do that with savepoints.

Yours,
Laurenz Albe


Reply With Quote
  #8  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: Nested Transactions - 09-10-2008 , 04:05 AM



Thomas Guettler <hv (AT) tbz-pariv (DOT) de> wrote:
Quote:
postgres supports nested transactions by using savepoints.
Unfortunately savepoints get lost after a commit.

Is there any plan to support nested transactions with
several (stacked) begin/commit statements?
I don't know for sure, but I don't find "nested transactions" in the TODO
list.

Quote:
I guess that it does *not* require a big code change:
If "begin" is used during a transaction it should behave
like a savepoint. And "commit/rollback" removes the last
element from the stack and does a real commit if the stack
gets empty.
It is not that simple.
A nested transaction must be able to commit even if the surrounding
transaction rolls back. You cannot do that with savepoints.

Yours,
Laurenz Albe


Reply With Quote
  #9  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: Nested Transactions - 09-10-2008 , 04:05 AM



Thomas Guettler <hv (AT) tbz-pariv (DOT) de> wrote:
Quote:
postgres supports nested transactions by using savepoints.
Unfortunately savepoints get lost after a commit.

Is there any plan to support nested transactions with
several (stacked) begin/commit statements?
I don't know for sure, but I don't find "nested transactions" in the TODO
list.

Quote:
I guess that it does *not* require a big code change:
If "begin" is used during a transaction it should behave
like a savepoint. And "commit/rollback" removes the last
element from the stack and does a real commit if the stack
gets empty.
It is not that simple.
A nested transaction must be able to commit even if the surrounding
transaction rolls back. You cannot do that with savepoints.

Yours,
Laurenz Albe


Reply With Quote
  #10  
Old   
Thomas Guettler
 
Posts: n/a

Default Re: Nested Transactions - 09-10-2008 , 09:52 AM



Laurenz Albe schrieb:
Quote:
Thomas Guettler <hv (AT) tbz-pariv (DOT) de> wrote:
postgres supports nested transactions by using savepoints.
Unfortunately savepoints get lost after a commit.
....

Quote:
It is not that simple.
A nested transaction must be able to commit even if the surrounding
transaction rolls back. You cannot do that with savepoints.
Hi,

for me the surrounding transaction is the first one (see below). If it
rolls back, everything should be rolled back. At least that what
sybase and mssql server do.

begin; -- 1 (surrounding transaction)
begin; -- savepoint tran2
update ...
commit; -- does nothing. rollback would restore to tran2
commit; -- does real commit, rollback would rollback

Microsoft http://msdn.microsoft.com/en-us/library/ms189336.aspx
Sybase http://manuals.sybase.com/onlinebook...;pt=53608;uf=0

Thomas

--
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.