Re: a with-transaction question

Kevin Rosenberg <kevin-HJRc7zDS/[email protected]> Mon, 16 Jan 2006 14:29:27 -0700
Newsgroups gmane.lisp.clsql.devel
Message-ID <[email protected]>
Aleksandar Bakic wrote:
> I am getting a warning from the postgres backend that some code is entering
> (via with-transaction) nested transactions. I looked at transaction.lisp and
> was puzzled by the fact that the with-transaction macro does not check for this
> situation, unlike start-transaction function, for example. What is the pattern
> here: should I call in-transaction-p myself or do something else to avoid
> nested transactions? Besides the warning, the checks of transaction-level at
> several places use only (= 1 transaction-level), so I am not confident nested
> transactions are safe.

CLSQL doesn't take a strong stand on nested transactions. SQL servers
vary in their transaction capability from no support at all to full
support for nested transactions.

For the most complete support, CLSQL would maintain metadata about the
SQL server capabilities and use that knowledge to signal conditions
about applications that use transactions incorrectly. 

But, since CLSQL does not have that capabilitity (patches welcomed!),
I'd recommend that you know what the capabilities are of your SQL
engine and write your application code to not violate those
capabilities. And, yes, if your application is structured since that
nested transactions can appear and your SQL egnine doesn't support
them, then checking a transaction-in-progress flag is a good idea.

Kevin