提交 6bc29540 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Fix one more issue with comp ALL (SELECT ...)

上级 d41c7df9
...@@ -97,18 +97,17 @@ public class ConditionInSelect extends Condition { ...@@ -97,18 +97,17 @@ public class ConditionInSelect extends Condition {
private Value getValueSlow(ResultInterface rows, Value l) { private Value getValueSlow(ResultInterface rows, Value l) {
// this only returns the correct result if the result has at least one // this only returns the correct result if the result has at least one
// row, and if l is not null // row, and if l is not null
boolean hasNull = false;
if (all) { if (all) {
while (rows.next()) { while (rows.next()) {
Value cmp = compare(l, rows); Value cmp = compare(l, rows);
if (cmp == ValueNull.INSTANCE) { if (cmp == ValueNull.INSTANCE) {
return ValueNull.INSTANCE; hasNull = true;
} else if (cmp == ValueBoolean.FALSE) { } else if (cmp == ValueBoolean.FALSE) {
return cmp; return cmp;
} }
} }
return ValueBoolean.TRUE;
} else { } else {
boolean hasNull = false;
while (rows.next()) { while (rows.next()) {
Value cmp = compare(l, rows); Value cmp = compare(l, rows);
if (cmp == ValueNull.INSTANCE) { if (cmp == ValueNull.INSTANCE) {
...@@ -117,11 +116,11 @@ public class ConditionInSelect extends Condition { ...@@ -117,11 +116,11 @@ public class ConditionInSelect extends Condition {
return cmp; return cmp;
} }
} }
if (hasNull) {
return ValueNull.INSTANCE;
}
return ValueBoolean.FALSE;
} }
if (hasNull) {
return ValueNull.INSTANCE;
}
return ValueBoolean.get(all);
} }
private Value compare(Value l, ResultInterface rows) { private Value compare(Value l, ResultInterface rows) {
......
...@@ -463,3 +463,6 @@ SELECT (3, 4) > ALL (SELECT ID, V FROM TEST); ...@@ -463,3 +463,6 @@ SELECT (3, 4) > ALL (SELECT ID, V FROM TEST);
DROP TABLE TEST; DROP TABLE TEST;
> ok > ok
SELECT 1 = ALL (SELECT * FROM VALUES (NULL), (1), (2), (NULL) ORDER BY 1);
>> FALSE
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论