@@ -666,6 +666,10 @@ def testProcExecutionInXact(self):
666666 with self .db .xact ():
667667 self .testProcExecution ()
668668
669+ def testProcExecutionInSubXact (self ):
670+ with self .db .xact (), self .db .xact ():
671+ self .testProcExecution ()
672+
669673 def testNULL (self ):
670674 # Directly commpare (SELECT NULL) is None
671675 self .failUnless (
@@ -1300,6 +1304,29 @@ def testFailedSubtransactionBlock(self):
13001304 # driver should have released/aborted instead
13011305 self .failUnlessEqual (err .source , 'CLIENT' )
13021306
1307+ def testSuccessfulSubtransactionBlock (self ):
1308+ with self .db .xact ():
1309+ with self .db .xact ():
1310+ self .db .execute ("create temp table subxact_sx1(i int);" )
1311+ with self .db .xact ():
1312+ self .db .execute ("create temp table subxact_sx2(i int);" )
1313+ # And, because I'm paranoid.
1314+ # The following block is used to make sure
1315+ # that savepoints are actually being set.
1316+ try :
1317+ with self .db .xact ():
1318+ self .db .execute ("selekt 1" )
1319+ except pg_exc .SyntaxError :
1320+ # Just in case the xact() aren't doing anything.
1321+ pass
1322+ with self .db .xact ():
1323+ self .db .execute ("create temp table subxact_sx3(i int);" )
1324+ # if it can't drop these tables, it didn't manage the subxacts
1325+ # properly.
1326+ self .db .execute ("drop table subxact_sx1" )
1327+ self .db .execute ("drop table subxact_sx2" )
1328+ self .db .execute ("drop table subxact_sx3" )
1329+
13031330 def testCloseInSubTransactionBlock (self ):
13041331 try :
13051332 with self .db .xact ():
0 commit comments