提交 7622dda9 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Fix array element reference

上级 fdaab385
......@@ -3892,10 +3892,7 @@ public class Parser {
if (readIf(OPEN_BRACKET)) {
Function function = Function.getFunction(database, "ARRAY_GET");
function.setParameter(0, r);
r = readExpression();
r = new BinaryOperation(OpType.PLUS, r, ValueExpression.get(ValueInt
.get(1)));
function.setParameter(1, r);
function.setParameter(1, readExpression());
r = function;
read(CLOSE_BRACKET);
}
......
......@@ -440,7 +440,7 @@ public class TestFunctions extends TestDb implements AggregateFunction {
stat.execute("create alias dynamic deterministic for \"" +
getClass().getName() + ".dynamic\"");
setCount(0);
rs = stat.executeQuery("call dynamic(('a', 1))[0]");
rs = stat.executeQuery("call dynamic(('a', 1))[1]");
rs.next();
String a = rs.getString(1);
assertEquals("a1", a);
......
......@@ -2,3 +2,15 @@
-- and the EPL 1.0 (http://h2database.com/html/license.html).
-- Initial Developer: H2 Group
--
SELECT (10, 20, 30)[1];
>> 10
SELECT (10, 20, 30)[3];
>> 30
SELECT (10, 20, 30)[0];
>> null
SELECT (10, 20, 30)[4];
>> null
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论