ArrayIndexOutOfBoundsException - indexNew=true - aggregate view numerical operator

5 views
Skip to first unread message

James

unread,
Jun 27, 2007, 10:37:53 AM6/27/07
to H2 Database
This works fine when indexNew = false

The following view (with any random table)

CREATE VIEW test_view AS
SELECT
COUNT(column_a) as my_count
FROM
my_table;

And the following query:
SELECT
*
FROM
test_view
WHERE
my_count > 1

Causes the following:
org.h2.jdbc.JdbcSQLException: General error:
java.lang.ArrayIndexOutOfBoundsException: i=0 size=0 [HY000-50]
at org.h2.message.Message.getSQLException(Message.java:65)
at org.h2.message.Message.convert(Message.java:374)
at org.h2.command.Command.executeQueryLocal(Command.java:75)
at org.h2.command.Command.executeQuery(Command.java:61)
at
org.h2.jdbc.JdbcPreparedStatement.executeQuery(JdbcPreparedStatement.java:
89)
at com.nokia.lcs.pcuplan.Database.fixMultipleNSEI(Database.java:1765)
at com.nokia.lcs.pcuplan.Main.doBSCPlan(Main.java:531)
at com.nokia.lcs.pcuplan.Main.start(Main.java:219)
at com.nokia.lcs.pcuplan.Main.main(Main.java:115)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:
90)
Caused by: java.lang.ArrayIndexOutOfBoundsException: i=0 size=0
at org.h2.util.ObjectArray.get(ObjectArray.java:53)
at org.h2.index.ViewIndexNew.find(ViewIndexNew.java:143)
at org.h2.table.TableFilter.next(TableFilter.java:216)
at org.h2.command.dml.Select.queryFlat(Select.java:273)
at org.h2.command.dml.Select.queryWithoutCache(Select.java:325)
at org.h2.command.dml.Query.query(Query.java:96)
at org.h2.index.ViewIndexNew.find(ViewIndexNew.java:156)
at org.h2.table.TableFilter.next(TableFilter.java:216)
at org.h2.command.dml.Select.queryFlat(Select.java:273)
at org.h2.command.dml.Select.queryWithoutCache(Select.java:325)
at org.h2.command.dml.Query.query(Query.java:96)
at org.h2.index.ViewIndexNew.find(ViewIndexNew.java:156)
at org.h2.table.TableFilter.next(TableFilter.java:216)
at org.h2.command.dml.Select.queryFlat(Select.java:273)
at org.h2.command.dml.Select.queryWithoutCache(Select.java:325)
at org.h2.command.dml.Query.query(Query.java:96)
at org.h2.command.CommandContainer.query(CommandContainer.java:73)
at org.h2.command.Command.executeQueryLocal(Command.java:72)
... 11 more

Thomas Mueller

unread,
Jun 27, 2007, 3:59:53 PM6/27/07
to h2-da...@googlegroups.com
Hi,

Yes, this is a bug. Thanks for the test case! This will be fixed in
the next release.

Thomas

Reply all
Reply to author
Forward
0 new messages