File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2169,8 +2169,8 @@ def commit(self):
21692169 self .state = 'committed'
21702170
21712171 @staticmethod
2172- def _rollback_to_string (id ):
2173- return 'ROLLBACK TO "xact(' + id .replace ('"' , '""' ) + ')";'
2172+ def _rollback_to_string (id , fmt = 'ROLLBACK TO "xact({0})"; RELEASE "xact({0})";' . format ):
2173+ return fmt ( id .replace ('"' , '""' ))
21742174
21752175 def rollback (self ):
21762176 if self .state == 'aborted' :
Original file line number Diff line number Diff line change @@ -1510,6 +1510,23 @@ def testSuccessfulSubtransactionBlock(self):
15101510 db .execute ("drop table subxact_sx2" )
15111511 db .execute ("drop table subxact_sx3" )
15121512
1513+ @pg_tmp
1514+ def testReleasedSavepoint (self ):
1515+ # validate that the rolled back savepoint is released as well.
1516+ x = None
1517+ with db .xact ():
1518+ try :
1519+ with db .xact ():
1520+ try :
1521+ with db .xact () as x :
1522+ db .execute ("selekt 1" )
1523+ except pg_exc .SyntaxError :
1524+ db .execute ('RELEASE "xact(' + hex (id (x )) + ')"' )
1525+ except pg_exc .InvalidSavepointSpecificationError as e :
1526+ pass
1527+ else :
1528+ self .fail ("InvalidSavepointSpecificationError not raised" )
1529+
15131530 @pg_tmp
15141531 def testCloseInSubTransactionBlock (self ):
15151532 try :
You can’t perform that action at this time.
0 commit comments