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

SELECT COUNT(*) FROM SYSTEM_RANGE(...) returned the wrong result.

上级 f9c41310
...@@ -18,7 +18,8 @@ Change Log ...@@ -18,7 +18,8 @@ Change Log
<h1>Change Log</h1> <h1>Change Log</h1>
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul><li>The Recover tool now also processes the log files, however applying those changes <ul><li>SELECT COUNT(*) FROM SYSTEM_RANGE(...) returned the wrong result. Fixed.
</li><li>The Recover tool now also processes the log files, however applying those changes
is still a manual process. is still a manual process.
</li><li>New sample application that shows how to pass data to a trigger. </li><li>New sample application that shows how to pass data to a trigger.
</li><li>More bugs in the server-less multi-connection mode have been fixed: </li><li>More bugs in the server-less multi-connection mode have been fixed:
......
...@@ -107,7 +107,7 @@ public class RangeTable extends Table { ...@@ -107,7 +107,7 @@ public class RangeTable extends Table {
} }
public long getRowCount(Session session) throws SQLException { public long getRowCount(Session session) throws SQLException {
return getMax(session) - getMin(session); return Math.max(0, getMax(session) - getMin(session) + 1);
} }
public String getTableType() { public String getTableType() {
......
...@@ -11,6 +11,7 @@ import java.util.Properties; ...@@ -11,6 +11,7 @@ import java.util.Properties;
import org.h2.Driver; import org.h2.Driver;
import org.h2.constant.SysProperties; import org.h2.constant.SysProperties;
import org.h2.engine.Constants; import org.h2.engine.Constants;
import org.h2.store.PageStore;
import org.h2.store.fs.FileSystemDisk; import org.h2.store.fs.FileSystemDisk;
import org.h2.test.bench.TestPerformance; import org.h2.test.bench.TestPerformance;
import org.h2.test.db.TestAlter; import org.h2.test.db.TestAlter;
...@@ -295,9 +296,10 @@ java org.h2.test.TestAll timer ...@@ -295,9 +296,10 @@ java org.h2.test.TestAll timer
System.setProperty("h2.maxMemoryRowsDistinct", "128"); System.setProperty("h2.maxMemoryRowsDistinct", "128");
System.setProperty("h2.check2", "true"); System.setProperty("h2.check2", "true");
int testRecoverToolProcessLog;
/* /*
javadoc: constructor parameters are not verified (PageOutputStream)
System.setProperty("h2.optimizeInList", "true"); System.setProperty("h2.optimizeInList", "true");
System.setProperty("h2.optimizeOr", "true"); System.setProperty("h2.optimizeOr", "true");
...@@ -352,14 +354,15 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1` ...@@ -352,14 +354,15 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
test.pageStore = true; test.pageStore = true;
test.runTests(); test.runTests();
TestPerformance.main("-init", "-db", "1"); TestPerformance.main("-init", "-db", "1");
Recover.execute("data", null); // Recover.execute("data", null);
// RunScript.execute("jdbc:h2:data/test2", "sa1", "sa1", "data/test.h2.sql", null, false); // RunScript.execute("jdbc:h2:data/test2",
// Recover.execute("data", null); // "sa1", "sa1", "data/test.h2.sql", null, false);
// Recover.execute("data", null);
System.setProperty(SysProperties.H2_PAGE_STORE, "false");
test.pageStore = false; // System.setProperty(SysProperties.H2_PAGE_STORE, "false");
test.runTests(); // test.pageStore = false;
TestPerformance.main("-init", "-db", "1"); // test.runTests();
// TestPerformance.main("-init", "-db", "1");
} }
System.out.println(TestBase.formatTime(System.currentTimeMillis() - time) + " total"); System.out.println(TestBase.formatTime(System.currentTimeMillis() - time) + " total");
} }
......
...@@ -6147,7 +6147,7 @@ not exists(select * from system_range(2, 32) r2 where r.x>r2.x and mod(r.x, r2.x ...@@ -6147,7 +6147,7 @@ not exists(select * from system_range(2, 32) r2 where r.x>r2.x and mod(r.x, r2.x
SELECT COUNT(*) FROM SYSTEM_RANGE(0, 2111222333); SELECT COUNT(*) FROM SYSTEM_RANGE(0, 2111222333);
> COUNT(*) > COUNT(*)
> ---------- > ----------
> 2111222333 > 2111222334
> rows: 1 > rows: 1
select * from system_range(2, 100) r where select * from system_range(2, 100) r where
......
select count(*) from system_range(1, 1);
> 1;
select count(*) from system_range(1, -1);
> 0;
select 1 from dual where '\' like '\' escape ''; select 1 from dual where '\' like '\' escape '';
> 1; > 1;
select left(timestamp '2001-02-03 08:20:31+04', 4); select left(timestamp '2001-02-03 08:20:31+04', 4);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论