[Python] Insert same values failed after rollback
Test Build: 9.1.0.0203
Test OS: Linux and windows
python driver: 9.1.0.0001
Test codes:
{code}
def test_01autocommit(self):
xddl1 = drop table if exists autocommit_t
self.cur.execute(xddl1)
ddl1 = create table autocommit_t (nameid int primary key ,age int,name VARCHAR(40))
self.cur.execute(ddl1)
self.con.set_autocommit(False)
self.assertEqual(self.con.get_autocommit(), False, autocommit is off)
self.cur.execute(insert into autocommit_t(name,nameid,age) values ('Mike',1,30),('John',2,28),('Bill',3,45) )
self.con.rollback()
self.cur.execute(select * from autocommit_t)
rows = self.cur.fetchall()
print \n
print len(rows)
self.assertEqual(len(rows), 0, 0 lines affected)
self.con.commit()
rows = self.cur.fetchall()
print len(rows)
self.assertEqual(len(rows), 0, 0 lines affected)
{code}
Test Result:
{noformat}
test_01autocommit (__main__.AutocommitTest) ...
3
0
ERROR
======================================================================
ERROR: test_01autocommit (__main__.AutocommitTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File python\_12_autocommit\test_auocommit_01.py, line 60, in test_01autocommit
self.cur.execute(insert into autocommit_t (name,nameid,age) values ('Mike',1,30),('John',2,28),('Bill',3,45))
File D:\Python27\lib\CUBRIDdb\cursors.py, line 77, in execute
r = self._cs.execute()
DatabaseError: (-670, 'ERROR: DBMS, -670, Operation would have caused one or more unique constraint violations. INDEX pk_autocommit_t_nameid(B+tree: 0
|153|1200) ON CLASS autocommit_t(CLASS_OID: 0|486|43). key: 1(OID: 0|760|40).')
----------------------------------------------------------------------
Ran 1 test in 0.101s
FAILED (errors=1)
{noformat}