提交 f11e8fa8 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Use more correct logic in Value.convertToRow()

上级 b1249945
......@@ -1337,18 +1337,19 @@ public abstract class Value extends VersionedValue {
return ValueArray.get(a);
}
private ValueRow convertToRow() {
private Value convertToRow() {
Value[] a;
switch (getValueType()) {
case ARRAY:
a = ((ValueArray) this).getList();
break;
case BLOB:
case CLOB:
case RESULT_SET:
a = new Value[] { ValueString.get(getString()) };
break;
default:
if (getValueType() == RESULT_SET) {
ResultInterface result = ((ValueResultSet) this).getResult();
if (result.hasNext()) {
a = result.currentRow();
if (result.hasNext()) {
throw DbException.get(ErrorCode.SCALAR_SUBQUERY_CONTAINS_MORE_THAN_ONE_ROW);
}
} else {
return ValueNull.INSTANCE;
}
} else {
a = new Value[] { this };
}
return ValueRow.get(a);
......
......@@ -84,5 +84,13 @@ SELECT ARRAY[1, NULL] IN (SELECT A FROM TEST);
SELECT ROW (ARRAY[1, NULL]) IN (SELECT A FROM TEST);
>> null
-- Compatibility with H2 1.4.197 and older
SELECT A FROM TEST WHERE A = (1, 2);
>> [1, 2]
-- Compatibility with H2 1.4.197 and older
INSERT INTO TEST VALUES ((1, 3));
> update count: 1
DROP TABLE TEST;
> ok
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论