提交 da62cac3 authored 作者: Thomas Mueller's avatar Thomas Mueller

MVCC: creating a table with an incorrect constraint could cause strange errors.

上级 15948d7f
...@@ -179,6 +179,7 @@ public class CreateTable extends SchemaCommand { ...@@ -179,6 +179,7 @@ public class CreateTable extends SchemaCommand {
} catch (DbException e) { } catch (DbException e) {
db.checkPowerOff(); db.checkPowerOff();
db.removeSchemaObject(session, table); db.removeSchemaObject(session, table);
session.commit(true);
throw e; throw e;
} }
return 0; return 0;
......
...@@ -33,8 +33,8 @@ public class TestMvcc1 extends TestBase { ...@@ -33,8 +33,8 @@ public class TestMvcc1 extends TestBase {
} }
public void test() throws SQLException { public void test() throws SQLException {
testSetMode();
testCases(); testCases();
testSetMode();
deleteDb("mvcc1"); deleteDb("mvcc1");
} }
...@@ -93,6 +93,16 @@ public class TestMvcc1 extends TestBase { ...@@ -93,6 +93,16 @@ public class TestMvcc1 extends TestBase {
c1.setAutoCommit(false); c1.setAutoCommit(false);
c2.setAutoCommit(false); c2.setAutoCommit(false);
// table rollback problem
try {
s1.execute("create table b(primary key(x))");
fail();
} catch (SQLException e) {
// ok
}
s1.execute("create table a(id int as 1 unique)");
s1.execute("drop table a");
// update same key problem // update same key problem
s1.execute("CREATE TABLE TEST(ID INT, NAME VARCHAR, PRIMARY KEY(ID))"); s1.execute("CREATE TABLE TEST(ID INT, NAME VARCHAR, PRIMARY KEY(ID))");
s1.execute("INSERT INTO TEST VALUES(1, 'Hello')"); s1.execute("INSERT INTO TEST VALUES(1, 'Hello')");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论