提交 999bc736 authored 作者: noelgrandin's avatar noelgrandin

Issue 517: Create or replace view statement has no effect on the others already…

Issue 517: Create or replace view statement has no effect on the others already existing JDBC connection    
上级 c95fa0ee
......@@ -24,7 +24,8 @@ Change Log
</li><li>MVStore: concurrency problems have been fixed.
</li><li>Improve error message when dropping an index that belongs to a constraint,
specify constraint in error message.
</li><li>Issue 518: java.sql.Connection.commit() freezes after LOB modification with EXCLUSIVE connection
</li><li>Issue 518: java.sql.Connection.commit() freezes after LOB modification with EXCLUSIVE connection
</li><li>Issue 517: Create or replace view statement has no effect on the others already existing JDBC connection
</li></ul>
<h2>Version 1.3.174 (2013-10-19)</h2>
......
......@@ -107,6 +107,7 @@ public class CreateView extends SchemaCommand {
view = new TableView(getSchema(), id, viewName, querySQL, null, columnNames, sysSession, false);
} else {
view.replace(querySQL, columnNames, sysSession, false, force);
view.setModified();
}
} finally {
sysSession.setCurrentSchema(db.getSchema(Constants.SCHEMA_MAIN));
......
......@@ -42,6 +42,7 @@ public class TestView extends TestBase {
testUnionReconnect();
testManyViews();
testReferenceView();
testViewAlterAndCommandCache();
deleteDb("view");
}
......@@ -205,4 +206,25 @@ public class TestView extends TestBase {
conn.close();
deleteDb("view");
}
/** make sure that when we change a view, that change in reflected in other sessions command cache */
private void testViewAlterAndCommandCache() throws SQLException {
deleteDb("view");
Connection conn = getConnection("view");
Statement stat = conn.createStatement();
stat.execute("create table t0(id int primary key)");
stat.execute("create table t1(id int primary key)");
stat.execute("insert into t0 values(0)");
stat.execute("insert into t1 values(1)");
stat.execute("create view v1 as select * from t0");
ResultSet rs = stat.executeQuery("select * from v1");
assertTrue(rs.next());
assertEquals(0, rs.getInt(1));
stat.execute("create or replace view v1 as select * from t1");
rs = stat.executeQuery("select * from v1");
assertTrue(rs.next());
assertEquals(1, rs.getInt(1));
conn.close();
deleteDb("view");
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论