提交 7296752c authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Fix comparison in ARRAY_CONTAINS

上级 16677754
......@@ -1054,7 +1054,7 @@ public class Function extends Expression implements FunctionCall {
Value v1 = getNullOrValue(session, args, values, 1);
Value[] list = ((ValueArray) v0).getList();
for (Value v : list) {
if (v.equals(v1)) {
if (database.areEqual(v, v1)) {
result = ValueBoolean.TRUE;
break;
}
......
......@@ -29,3 +29,28 @@ select array_contains(((1, 2), (3, 4)), (1, 2));
select array_contains(((1, 2), (3, 4)), (5, 6));
>> FALSE
CREATE TABLE TEST (ID INT PRIMARY KEY AUTO_INCREMENT, A ARRAY);
> ok
INSERT INTO TEST (A) VALUES ((1L, 2L)), ((3L, 4L));
> update count: 2
SELECT ID, ARRAY_CONTAINS(A, 1L), ARRAY_CONTAINS(A, 2L), ARRAY_CONTAINS(A, 3L), ARRAY_CONTAINS(A, 4L) FROM TEST;
> ID ARRAY_CONTAINS(A, 1) ARRAY_CONTAINS(A, 2) ARRAY_CONTAINS(A, 3) ARRAY_CONTAINS(A, 4)
> -- -------------------- -------------------- -------------------- --------------------
> 1 TRUE TRUE FALSE FALSE
> 2 FALSE FALSE TRUE TRUE
> rows: 2
SELECT * FROM (
SELECT ID, ARRAY_CONTAINS(A, 1L), ARRAY_CONTAINS(A, 2L), ARRAY_CONTAINS(A, 3L), ARRAY_CONTAINS(A, 4L) FROM TEST
);
> ID ARRAY_CONTAINS(A, 1) ARRAY_CONTAINS(A, 2) ARRAY_CONTAINS(A, 3) ARRAY_CONTAINS(A, 4)
> -- -------------------- -------------------- -------------------- --------------------
> 1 TRUE TRUE FALSE FALSE
> 2 FALSE FALSE TRUE TRUE
> rows: 2
DROP TABLE TEST;
> ok
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论