提交 2229f0ed authored 作者: Thomas Mueller's avatar Thomas Mueller

In memory database: outer joins with a condition "column is null" could return the wrong result.

上级 6978de4a
......@@ -237,6 +237,7 @@ public class TableFilter implements ColumnResolver {
*/
public void prepare() {
// forget all unused index conditions
// the indexConditions list may be modified here
for (int i = 0; i < indexConditions.size(); i++) {
IndexCondition condition = indexConditions.get(i);
if (!condition.isAlwaysFalse()) {
......@@ -530,7 +531,15 @@ public class TableFilter implements ColumnResolver {
if (join == null) {
join = filter;
filter.joinOuter = outer;
if (!SysProperties.NESTED_JOINS) {
if (SysProperties.NESTED_JOINS) {
if (outer) {
filter.visit(new TableFilterVisitor() {
public void accept(TableFilter f) {
f.joinOuterIndirect = true;
}
});
}
} else {
if (outer) {
// convert all inner joins on the right hand side to outer joins
TableFilter f = filter.join;
......@@ -667,6 +676,7 @@ public class TableFilter implements ColumnResolver {
* Remove all index conditions that are not used by the current index.
*/
void removeUnusableIndexConditions() {
// the indexConditions list may be modified here
for (int i = 0; i < indexConditions.size(); i++) {
IndexCondition cond = indexConditions.get(i);
if (!cond.isEvaluatable()) {
......
......@@ -4,7 +4,7 @@
* (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package org.h2.test.db;
package org.h2.test.synth;
import java.io.File;
import java.io.StringReader;
......@@ -104,7 +104,8 @@ public class TestNestedJoins extends TestBase {
}
}
Random random = new Random(1);
for (int i = 0; i < 10000; i++) {
int size = getSize(1000, 10000);
for (int i = 0; i < size; i++) {
StringBuilder buff = new StringBuilder();
int t = 1 + random.nextInt(9);
buff.append("select ");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论