提交 7c27a8da authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Use correct ARRAY syntax in array tests

上级 4412a506
...@@ -440,7 +440,7 @@ public class TestFunctions extends TestDb implements AggregateFunction { ...@@ -440,7 +440,7 @@ public class TestFunctions extends TestDb implements AggregateFunction {
stat.execute("create alias dynamic deterministic for \"" + stat.execute("create alias dynamic deterministic for \"" +
getClass().getName() + ".dynamic\""); getClass().getName() + ".dynamic\"");
setCount(0); setCount(0);
rs = stat.executeQuery("call dynamic(('a', 1))[1]"); rs = stat.executeQuery("call dynamic(ARRAY['a', 1])[1]");
rs.next(); rs.next();
String a = rs.getString(1); String a = rs.getString(1);
assertEquals("a1", a); assertEquals("a1", a);
......
...@@ -176,7 +176,7 @@ public class TestMetaData extends TestDb { ...@@ -176,7 +176,7 @@ public class TestMetaData extends TestDb {
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
stat.execute("create table a(x array)"); stat.execute("create table a(x array)");
stat.execute("insert into a values((1, 2))"); stat.execute("insert into a values(ARRAY[1, 2])");
rs = stat.executeQuery("SELECT x[1] FROM a"); rs = stat.executeQuery("SELECT x[1] FROM a");
ResultSetMetaData rsMeta = rs.getMetaData(); ResultSetMetaData rsMeta = rs.getMetaData();
assertEquals(Types.NULL, rsMeta.getColumnType(1)); assertEquals(Types.NULL, rsMeta.getColumnType(1));
......
...@@ -3,37 +3,37 @@ ...@@ -3,37 +3,37 @@
-- Initial Developer: H2 Group -- Initial Developer: H2 Group
-- --
select array_contains((4.0, 2.0, 2.0), 2.0); select array_contains(ARRAY[4.0, 2.0, 2.0], 2.0);
>> TRUE >> TRUE
select array_contains((4.0, 2.0, 2.0), 5.0); select array_contains(ARRAY[4.0, 2.0, 2.0], 5.0);
>> FALSE >> FALSE
select array_contains(('one', 'two'), 'one'); select array_contains(ARRAY['one', 'two'], 'one');
>> TRUE >> TRUE
select array_contains(('one', 'two'), 'xxx'); select array_contains(ARRAY['one', 'two'], 'xxx');
>> FALSE >> FALSE
select array_contains(('one', 'two'), null); select array_contains(ARRAY['one', 'two'], null);
>> FALSE >> FALSE
select array_contains((null, 'two'), null); select array_contains(ARRAY[null, 'two'], null);
>> TRUE >> TRUE
select array_contains(null, 'one'); select array_contains(null, 'one');
>> null >> null
select array_contains(((1, 2), (3, 4)), (1, 2)); select array_contains(ARRAY[ARRAY[1, 2], ARRAY[3, 4]], ARRAY[1, 2]);
>> TRUE >> TRUE
select array_contains(((1, 2), (3, 4)), (5, 6)); select array_contains(ARRAY[ARRAY[1, 2], ARRAY[3, 4]], ARRAY[5, 6]);
>> FALSE >> FALSE
CREATE TABLE TEST (ID INT PRIMARY KEY AUTO_INCREMENT, A ARRAY); CREATE TABLE TEST (ID INT PRIMARY KEY AUTO_INCREMENT, A ARRAY);
> ok > ok
INSERT INTO TEST (A) VALUES ((1L, 2L)), ((3L, 4L)); INSERT INTO TEST (A) VALUES (ARRAY[1L, 2L]), (ARRAY[3L, 4L]);
> update count: 2 > update count: 2
SELECT ID, ARRAY_CONTAINS(A, 1L), ARRAY_CONTAINS(A, 2L), ARRAY_CONTAINS(A, 3L), ARRAY_CONTAINS(A, 4L) FROM TEST; SELECT ID, ARRAY_CONTAINS(A, 1L), ARRAY_CONTAINS(A, 2L), ARRAY_CONTAINS(A, 3L), ARRAY_CONTAINS(A, 4L) FROM TEST;
......
...@@ -1395,7 +1395,7 @@ drop table test; ...@@ -1395,7 +1395,7 @@ drop table test;
create table test(id int primary key, data array); create table test(id int primary key, data array);
> ok > ok
insert into test values(1, (1, 1)), (2, (1, 2)), (3, (1, 1, 1)); insert into test values(1, ARRAY[1, 1]), (2, ARRAY[1, 2]), (3, ARRAY[1, 1, 1]);
> update count: 3 > update count: 3
select * from test order by data; select * from test order by data;
...@@ -2011,10 +2011,10 @@ select (1, 2); ...@@ -2011,10 +2011,10 @@ select (1, 2);
create table array_test(x array); create table array_test(x array);
> ok > ok
insert into array_test values((1, 2, 3)), ((2, 3, 4)); insert into array_test values(ARRAY[1, 2, 3]), (ARRAY[2, 3, 4]);
> update count: 2 > update count: 2
select * from array_test where x = (1, 2, 3); select * from array_test where x = ARRAY[1, 2, 3];
> X > X
> --------- > ---------
> [1, 2, 3] > [1, 2, 3]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论