Re: TODO: Add a GUC to control whether BEGIN inside - Mailing list pgsql-hackers

From Lukas Kahwe Smith
Subject Re: TODO: Add a GUC to control whether BEGIN inside
Date
Msg-id 459AAC25.4060207@pooteeweet.org
Whole thread Raw
In response to Re: TODO: Add a GUC to control whether BEGIN inside  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: TODO: Add a GUC to control whether BEGIN inside  (Jim Nasby <decibel@decibel.org>)
List pgsql-hackers
Tom Lane wrote:
> Lukas Kahwe Smith <smith@pooteeweet.org> writes:
>> 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.
> 
> It's not that hard, is it?
> 
>     if (PQtransactionStatus(conn) == PQTRANS_IDLE)
>         PQexec(conn, "BEGIN");
>     else
>         PQexec(conn, "SAVEPOINT foo");

Its not exactly convenient either, especially in the case of modular 
code that may be developed by different people. Anyways, like I said I 
have a solution in my framework to make life of module developers 
easier. Obviously proper nested transactions would be the ideal, but so 
it goes. I was just throwing this out here when I saw Peter's comment.

regards,
Lukas


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [PATCHES] xlog directory at initdb time
Next
From: David Boreham
Date:
Subject: Re: TODO: GNU TLS