提交 53d868b5 authored 作者: Thomas Mueller's avatar Thomas Mueller

The optimization for IN(...) queries combined with OR could result in a strange…

The optimization for IN(...) queries combined with OR could result in a strange exception of the type "column x must be included in the group by list".
上级 23bc0805
...@@ -142,9 +142,11 @@ public class ConditionInConstantSet extends Condition { ...@@ -142,9 +142,11 @@ public class ConditionInConstantSet extends Condition {
Expression getAdditional(Session session, Comparison other) { Expression getAdditional(Session session, Comparison other) {
Expression add = other.getIfEquals(left); Expression add = other.getIfEquals(left);
if (add != null) { if (add != null) {
valueList.add(add); if (add.isConstant()) {
valueSet.add(add.getValue(session).convertTo(left.getType())); valueList.add(add);
return this; valueSet.add(add.getValue(session).convertTo(left.getType()));
return this;
}
} }
return null; return null;
} }
......
--- special grammar and test cases --------------------------------------------------------------------------------------------- --- special grammar and test cases ---------------------------------------------------------------------------------------------
select * from dual where x = x + 1 or x in(2, 0);
> X
> -
> rows: 0
select * from system_range(1,1) order by x limit 3 offset 3; select * from system_range(1,1) order by x limit 3 offset 3;
> X > X
> - > -
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论