提交 4c3e20e0 authored 作者: Thomas Mueller's avatar Thomas Mueller

When the system property h2.nestedJoins was enabled, some outer joins returned the wrong result.

上级 e8fbeb52
......@@ -911,10 +911,10 @@ public class Select extends Query {
if (on != null) {
if (!on.isEverything(ExpressionVisitor.EVALUATABLE_VISITOR)) {
if (SysProperties.NESTED_JOINS) {
f.removeJoinCondition();
// need to check that all added are bound to a table
on = on.optimize(session);
if (!f.isJoinOuter() && !f.isJoinOuterIndirect()) {
f.removeJoinCondition();
addCondition(on);
}
} else {
......
......@@ -243,6 +243,20 @@ public class TestNestedJoins extends TestBase {
ResultSet rs;
String sql;
/*
create table test(id int primary key);
insert into test values(1);
select b.id from test a left outer join test b on a.id = b.id and not exists (select * from test c where c.id = b.id);
-- expected: null
*/
stat.execute("create table test(id int primary key)");
stat.execute("insert into test values(1)");
rs = stat.executeQuery("select b.id from test a left outer join test b on a.id = b.id and not exists (select * from test c where c.id = b.id)");
assertTrue(rs.next());
sql = rs.getString(1);
assertEquals(null, sql);
stat.execute("drop table test");
/*
create table test(id int primary key);
explain select * from test a left outer join (test c) on a.id = c.id;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论