提交 1d37da8a authored 作者: Thomas Mueller's avatar Thomas Mueller

In version 1.3.183, indexes that contains columns with a default value generated…

In version 1.3.183, indexes that contains columns with a default value generated by a sequence where not used. This includes identity and auto-increment columns. This bug was introduced by supporting "rownum" in views and derived tables.
上级 78f8f12a
...@@ -17,7 +17,9 @@ Change Log ...@@ -17,7 +17,9 @@ Change Log
<h1>Change Log</h1> <h1>Change Log</h1>
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul><li>- <ul><li>In version 1.3.183, indexes that contains columns with a default value
generated by a sequence where not used. This includes identity and auto-increment
columns. This bug was introduced by supporting "rownum" in views and derived tables.
</li></ul> </li></ul>
<h2>Version 1.4.183 Beta (2014-12-13)</h2> <h2>Version 1.4.183 Beta (2014-12-13)</h2>
......
...@@ -333,12 +333,6 @@ public abstract class Table extends SchemaObjectBase { ...@@ -333,12 +333,6 @@ public abstract class Table extends SchemaObjectBase {
* @return true if the table contains no query-comparable column * @return true if the table contains no query-comparable column
*/ */
public boolean isQueryComparable() { public boolean isQueryComparable() {
ExpressionVisitor visitor = ExpressionVisitor.QUERY_COMPARABLE_VISITOR;
for (Column col : columns) {
if (!col.isEverything(visitor)) {
return false;
}
}
return true; return true;
} }
......
...@@ -41,6 +41,7 @@ public class TestOptimizations extends TestBase { ...@@ -41,6 +41,7 @@ public class TestOptimizations extends TestBase {
@Override @Override
public void test() throws Exception { public void test() throws Exception {
deleteDb("optimizations"); deleteDb("optimizations");
testIdentityIndexUsage();
testFastRowIdCondition(); testFastRowIdCondition();
testExplainRoundTrip(); testExplainRoundTrip();
testOrderByExpression(); testOrderByExpression();
...@@ -79,6 +80,18 @@ public class TestOptimizations extends TestBase { ...@@ -79,6 +80,18 @@ public class TestOptimizations extends TestBase {
testConvertOrToIn(); testConvertOrToIn();
deleteDb("optimizations"); deleteDb("optimizations");
} }
private void testIdentityIndexUsage() throws Exception {
Connection conn = getConnection("optimizations");
Statement stat = conn.createStatement();
stat.execute("create table test(a identity)");
stat.execute("insert into test values()");
ResultSet rs = stat.executeQuery("explain select * from test where a = 1");
rs.next();
assertContains(rs.getString(1), "PRIMARY_KEY");
stat.execute("drop table test");
conn.close();
}
private void testFastRowIdCondition() throws Exception { private void testFastRowIdCondition() throws Exception {
Connection conn = getConnection("optimizations"); Connection conn = getConnection("optimizations");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论