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

Re: TODO: Add a GUC to control whether BEGIN inside

From: Lukas Kahwe Smith <smith(at)pooteeweet(dot)org>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Subject: Re: TODO: Add a GUC to control whether BEGIN inside
Date: 2007-01-02 16:48:15
Message-ID: 459A8CCF.1090408@pooteeweet.org (view raw or flat)
Thread:
Lists: pgsql-hackers
Alvaro Herrera wrote:
> news.postgresql.org wrote:
> 
>> While we are on the topic, I have implemented a poor mans nested 
>> transaction feature into my database access layer. essentially 
>> subsequent calls to begin a transaction after the initial begin simply 
>> increase an internal counter and set a savepoint. as you commit the 
>> transactions the counter is decreased and the savepoints are released. 
>> maybe this could be implemented inside postgresql to make the life of 
>> modular programmers easier?
> 
> Yeah, it's called "SAVEPOINT foo" and "RELEASE foo".

Err, I think you misunderstood what I said. My implementation uses 
SAVEPOINTs already. The point is having some API where you do not have 
to care of you are already in a transaction or not. Depending on if you 
are it will either open a new transaction or simply place a savepoint.

with the following invented commands:
MBEGIN FOO1 // open transaction; set counter to 1
MBEGIN FOO2 // set savepoint FOO2; set counter to 2
MBEGIN FOO3 // set savepoint FOO3; set counter to 3
MROLLBACK FOO3 // rollback to FOO3; set counter to 2
MCOMMIT FOO2 // release FOO2; set counter to 1
MCOMMIT FOO1 // commit

regards,
Lukas

regards,
Lukas


In response to

Responses

pgsql-hackers by date

Next:From: Joshua D. DrakeDate: 2007-01-02 17:26:05
Subject: Re: TODO: Add a GUC to control whether BEGIN inside
Previous:From: Alvaro HerreraDate: 2007-01-02 16:42:36
Subject: Re: TODO: Add a GUC to control whether BEGIN inside

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