提交 3b16b62f authored 作者: noelgrandin's avatar noelgrandin

Fix bug in DROP ALL OBJECTS when dealing with inter-schema dependencies.

上级 8b0c4f6b
...@@ -60,6 +60,7 @@ Change Log ...@@ -60,6 +60,7 @@ Change Log
</li><li>Fix an issue with storing Unicode surrogate pairs in CLOB columns. </li><li>Fix an issue with storing Unicode surrogate pairs in CLOB columns.
</li><li>H2 console: add SHIFT+ENTER "run selected" functionality </li><li>H2 console: add SHIFT+ENTER "run selected" functionality
</li><li>Fix bug in DB2 syntax "select * from test with ur", patch from litailang </li><li>Fix bug in DB2 syntax "select * from test with ur", patch from litailang
</li><li>Fix bug in DROP ALL OBJECTS when dealing with inter-schema dependencies.
</li></ul> </li></ul>
<h2>Version 1.3.174 (2013-10-19)</h2> <h2>Version 1.3.174 (2013-10-19)</h2>
......
...@@ -47,12 +47,6 @@ public class DropDatabase extends DefineCommand { ...@@ -47,12 +47,6 @@ public class DropDatabase extends DefineCommand {
session.commit(true); session.commit(true);
Database db = session.getDatabase(); Database db = session.getDatabase();
db.lockMeta(session); db.lockMeta(session);
// TODO local temp tables are not removed
for (Schema schema : db.getAllSchemas()) {
if (schema.canDrop()) {
db.removeDatabaseObject(session, schema);
}
}
// There can be dependencies between tables e.g. using computed columns, // There can be dependencies between tables e.g. using computed columns,
// so we might need to loop over them multiple times. // so we might need to loop over them multiple times.
...@@ -92,6 +86,12 @@ public class DropDatabase extends DefineCommand { ...@@ -92,6 +86,12 @@ public class DropDatabase extends DefineCommand {
} }
} while (runLoopAgain); } while (runLoopAgain);
// TODO local temp tables are not removed
for (Schema schema : db.getAllSchemas()) {
if (schema.canDrop()) {
db.removeDatabaseObject(session, schema);
}
}
session.findLocalTempTable(null); session.findLocalTempTable(null);
ArrayList<SchemaObject> list = New.arrayList(); ArrayList<SchemaObject> list = New.arrayList();
list.addAll(db.getAllSchemaObjects(DbObject.SEQUENCE)); list.addAll(db.getAllSchemaObjects(DbObject.SEQUENCE));
......
...@@ -36,6 +36,7 @@ public class TestDrop extends TestBase { ...@@ -36,6 +36,7 @@ public class TestDrop extends TestBase {
testTableDependsOnView(); testTableDependsOnView();
testComputedColumnDependency(); testComputedColumnDependency();
testInterSchemaDependency();
conn.close(); conn.close();
deleteDb("drop"); deleteDb("drop");
...@@ -60,4 +61,17 @@ public class TestDrop extends TestBase { ...@@ -60,4 +61,17 @@ public class TestDrop extends TestBase {
stat.execute("DROP SCHEMA TEST_SCHEMA"); stat.execute("DROP SCHEMA TEST_SCHEMA");
} }
private void testInterSchemaDependency() throws SQLException {
stat.execute("drop all objects;");
stat.execute("create schema table_view");
stat.execute("set schema table_view");
stat.execute("create table test1 (id int, name varchar(20))");
stat.execute("create view test_view_1 as (select * from test1)");
stat.execute("set schema public");
stat.execute("create schema test_run");
stat.execute("set schema test_run");
stat.execute("create table test2 (vid int, address varchar(20), constraint a_cons check (vid in (select id from table_view.test1)))");
stat.execute("set schema public");
stat.execute("drop all objects");
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论