提交 27df6632 authored 作者: Thomas Mueller's avatar Thomas Mueller

Sequences of temporary tables (auto-increment or identity columns) were…

Sequences of temporary tables (auto-increment or identity columns) were persisted unnecessarily in the database file, and were not removed when re-opening the database.
上级 d56ca58d
...@@ -302,7 +302,9 @@ public class Sequence extends SchemaObjectBase { ...@@ -302,7 +302,9 @@ public class Sequence extends SchemaObjectBase {
long realValue = value; long realValue = value;
try { try {
value = valueWithMargin; value = valueWithMargin;
if (!isTemporary()) {
database.update(session, this); database.update(session, this);
}
} finally { } finally {
value = realValue; value = realValue;
} }
......
...@@ -32,6 +32,7 @@ public class TestTempTables extends TestBase { ...@@ -32,6 +32,7 @@ public class TestTempTables extends TestBase {
@Override @Override
public void test() throws SQLException { public void test() throws SQLException {
deleteDb("tempTables"); deleteDb("tempTables");
testTempSequence();
testTempFileResultSet(); testTempFileResultSet();
testTempTableResultSet(); testTempTableResultSet();
testTransactionalTemp(); testTransactionalTemp();
...@@ -47,6 +48,21 @@ public class TestTempTables extends TestBase { ...@@ -47,6 +48,21 @@ public class TestTempTables extends TestBase {
deleteDb("tempTables"); deleteDb("tempTables");
} }
private void testTempSequence() throws SQLException {
deleteDb("tempTables");
Connection conn = getConnection("tempTables");
Statement stat = conn.createStatement();
stat.execute("create local temporary table test(id identity)");
stat.execute("insert into test values(null)");
stat.execute("shutdown");
conn.close();
conn = getConnection("tempTables");
ResultSet rs = conn.createStatement().executeQuery(
"select * from information_schema.sequences");
assertFalse(rs.next());
conn.close();
}
private void testTempFileResultSet() throws SQLException { private void testTempFileResultSet() throws SQLException {
deleteDb("tempTables"); deleteDb("tempTables");
Connection conn = getConnection("tempTables;MAX_MEMORY_ROWS=10"); Connection conn = getConnection("tempTables;MAX_MEMORY_ROWS=10");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论